自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

在Linux上檢查MySQL/MariaDB數(shù)據(jù)庫(kù)正常運(yùn)行時(shí)間的三種方法

系統(tǒng) Linux MariaDB
如果要檢查 Linux 上的其他服務(wù)(例如 Apache、MySQL、MariaDB、sftp 等)運(yùn)行了多長(zhǎng)時(shí)間,該怎么做?每個(gè)服務(wù)都有自己的命令來(lái)檢查服務(wù)的正常運(yùn)行時(shí)間。但是你也可以為此使用其他命令。

[[328227]]

我們都知道在 Linux 中使用 uptime 命令的目的。它用于檢查 Linux 系統(tǒng)的正常運(yùn)行時(shí)間以及系統(tǒng)上次啟動(dòng)以來(lái)運(yùn)行的時(shí)間。

而 Linux 管理員的工作是保持系統(tǒng)正常運(yùn)行。

如果要檢查 Linux 上的其他服務(wù)(例如 Apache、MySQL、MariaDB、sftp 等)運(yùn)行了多長(zhǎng)時(shí)間,該怎么做?

每個(gè)服務(wù)都有自己的命令來(lái)檢查服務(wù)的正常運(yùn)行時(shí)間。但是你也可以為此使用其他命令。

方法 1:如何使用 ps 命令在 Linux 上檢查 MySQL/MariaDB 數(shù)據(jù)庫(kù)的正常運(yùn)行時(shí)間

rocess-monitoring/" class="ext" rel="external nofollow" target="_blank">ps 命令的意思是進(jìn)程狀態(tài)process status。這是最基本的命令之一,它顯示了系統(tǒng)正在運(yùn)行的進(jìn)程的詳細(xì)信息。

為此,你首先需要使用 rocess-id-pid-ppid-linux/" class="ext" rel="external nofollow" target="_blank">pidof 命令查找 MySQL/MariaDB 的 PID。

  1. # pidof mysqld | cut -d" " -f1
  2.  
  3. 2412

獲取 MySQL/MariaDB 的 PID 后,請(qǐng)?jiān)?ps 命令中使用 --etime 選項(xiàng)獲得正常運(yùn)行時(shí)間。

  • --etime:自進(jìn)程啟動(dòng)以來(lái)經(jīng)過的時(shí)間,形式為 [[DD-]hh:]mm:ss。
  1. # ps -p 2412 -o etime
  2.  
  3. ELAPSED
  4. 2-08:49:30

或者,在 ps 命令中使用 --lstart 選項(xiàng)來(lái)獲取指定 PID 的正常運(yùn)行時(shí)間。

  1. # ps -p 2412 -o lstart
  2.  
  3. STARTED
  4. Sat May 2 03:02:15 2020

MySQL/MariaDB 進(jìn)程已經(jīng)運(yùn)行了 2 天 03 小時(shí) 02 分 15 秒。

方法 2:如何使用 systemctl 命令在 Linux 上檢查 MySQL/MariaDB 數(shù)據(jù)庫(kù)的正常運(yùn)行時(shí)間

systemctl 命令用于控制 systemd 系統(tǒng)和服務(wù)管理器。

systemd 是新的初始化系統(tǒng)和系統(tǒng)管理器,現(xiàn)在大多數(shù) Linux 發(fā)行版都淘汰了傳統(tǒng)的 SysVinit 管理器而采用了 systemd。

  1. # systemctl status mariadb
  2. 或者
  3. # systemctl status mysql
  4.  
  5. mariadb.service - MariaDB 10.1.44 database server
  6. Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
  7. Drop-In: /etc/systemd/system/mariadb.service.d
  8. └─migrated-from-my.cnf-settings.conf
  9. Active: active (running) since Sat 2020-05-02 03:02:18 UTC; 2 days ago
  10. Docs: man:mysqld(8)
  11. https://mariadb.com/kb/en/library/systemd/
  12. Process: 2448 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  13. Process: 2388 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=/usr/bin/galera_recovery; [ $? -eq 0 ] && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
  14. Process: 2386 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  15. Main PID: 2412 (mysqld)
  16. Status: "Taking your SQL requests now…"
  17. CGroup: /system.slice/mariadb.service
  18. └─2412 /usr/sbin/mysqld
  19.  
  20. May 03 21:41:26 ns2.2daygeek.com mysqld[2412]: 2020-05-03 21:41:26 140328136861440 [Warning] Host name '1.1.1.1' could not be resolved: not known
  21. May 04 02:00:46 ns2.2daygeek.com mysqld[2412]: 2020-05-04 2:00:46 140328436418304 [Warning] IP address '1.1.1.1' has been resolved to the host name '2…ss itself.
  22. May 04 03:01:31 ns2.2daygeek.com mysqld[2412]: 2020-05-04 3:01:31 140328436111104 [Warning] IP address '1.1.1.1' could not be resolved: Temporary fai…resolution
  23. May 04 04:03:06 ns2.2daygeek.com mysqld[2412]: 2020-05-04 4:03:06 140328136861440 [Warning] IP address '1.1.1.1' could not be resolved: Name or ser… not known
  24. May 04 07:23:54 ns2.2daygeek.com mysqld[2412]: 2020-05-04 7:23:54 140328435189504 [Warning] IP address '1.1.1.1' could not be resolved: Name or service not known
  25. May 04 08:03:31 ns2.2daygeek.com mysqld[2412]: 2020-05-04 8:03:31 140328436418304 [Warning] IP address '1.1.1.1' could not be resolved: Name or service not known
  26. May 04 08:25:56 ns2.2daygeek.com mysqld[2412]: 2020-05-04 8:25:56 140328135325440 [Warning] IP address '1.1.1.1' could not be resolved: Name or service not known
  27. Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.
  28. Hint: Some lines were ellipsized, use -l to show in full.

方法 3:如何使用 MySQLAdmin 命令在 Linux 上檢查 MySQL/MariaDB 數(shù)據(jù)庫(kù)的正常運(yùn)行時(shí)間

MySQLAdmin 是安裝 MySQL 軟件包時(shí)安裝的 MySQL 服務(wù)器命令行程序。

MySQLAdmin 客戶端允許你在 MySQL 服務(wù)器上執(zhí)行一些基本的管理功能。

它用于創(chuàng)建數(shù)據(jù)庫(kù)、刪除數(shù)據(jù)庫(kù)、設(shè)置 root 密碼、更改 root 密碼、檢查 MySQL 狀態(tài)、驗(yàn)證 MySQL 功能、監(jiān)視 mysql 進(jìn)程以及驗(yàn)證服務(wù)器的配置。

  1. # mysqladmin -u root -pPassword version
  2.  
  3. mysqladmin Ver 8.42 Distrib 5.7.27, for Linux on x86_64
  4. Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  5.  
  6. Oracle is a registered trademark of Oracle Corporation and/or its
  7. affiliates. Other names may be trademarks of their respective
  8. owners.
  9.  
  10. Server version 5.7.27
  11. Protocol version 10
  12. Connection Localhost via UNIX socket
  13. UNIX socket /var/lib/mysql/mysql.sock
  14. Uptime: 1 day 10 hours 44 min 13 sec

 

責(zé)任編輯:龐桂玉 來(lái)源: Linux中國(guó)
相關(guān)推薦

2019-01-15 14:00:59

Linux服務(wù)器命令

2022-08-19 11:17:09

Linux

2010-07-29 09:56:45

Flex數(shù)據(jù)庫(kù)

2010-11-19 14:51:09

Oracle數(shù)據(jù)庫(kù)關(guān)閉

2015-12-11 09:24:38

加密數(shù)據(jù)Linux

2009-07-22 11:33:14

JDBC連接Sybas

2022-11-04 09:09:54

Linux服務(wù)器

2019-06-06 09:20:31

2021-06-24 10:28:19

uptimed命令Linux

2022-05-09 07:20:10

監(jiān)控項(xiàng)目工具

2021-05-10 07:30:07

Linux統(tǒng)計(jì)程序

2021-08-11 11:02:17

Linuxtime命令

2021-05-11 11:52:23

Linuxtime命令

2023-02-21 14:58:12

間序列周期數(shù)據(jù)集

2009-10-28 18:00:34

Visual C#數(shù)據(jù)

2010-09-13 15:41:23

sql server數(shù)

2022-11-18 15:09:29

2014-04-01 10:38:09

Linux操作系統(tǒng)

2011-05-26 13:16:37

Oracle數(shù)據(jù)庫(kù)備份

2010-10-20 13:52:07

SQL Server數(shù)
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)