日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

对正在运行的mysql进行监控

發布時間:2024/1/17 数据库 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 对正在运行的mysql进行监控 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

對正在運行的mysql進行監控,其中一個方式就是查看mysql運行狀態。

(1)QPS(每秒Query量)

QPS = Questions(or Queries) / seconds

mysql > show global status like "Question%";

(2)TPS(每秒事務量)

TPS = (Com_commit + Com_rollback) / seconds

mysql > show global status like "Com_commit";

mysql > show global status like "Com_rollback";

(3)key Buffer 命中率

mysql>show global status like "key%";

key_buffer_read_hits = (1-key_reads / key_read_requests) * 100%

key_buffer_write_hits = (1-key_writes / key_write_requests) * 100%

(4)InnoDB Buffer命中率

mysql> show status like "innodb_buffer_pool_read%";

innodb_buffer_read_hits = (1 - innodb_buffer_pool_reads / innodb_buffer_pool_read_requests) * 100%

(5)Query Cache命中率

mysql> show status like "Qcache%";

Query_cache_hits = (Qcahce_hits / (Qcache_hits + Qcache_inserts )) * 100%;

(6)Table Cache狀態量

mysql> show global status like "open%";

比較 open_tables 與 opend_tables 值

(7)Thread Cache 命中率

mysql> show global status like "Thread%";

mysql> show global status like "Connections";

Thread_cache_hits = (1 - Threads_created / connections ) * 100%

(8)鎖定狀態

mysql> show global status like "%lock%";

Table_locks_waited/Table_locks_immediate=0.3% 如果這個比值比較大的話,說明表鎖造成的阻塞比較嚴重

Innodb_row_lock_waits innodb行鎖,太大可能是間隙鎖造成的

(9)復制延時量

mysql > show slave status

查看延時時間

(10) Tmp Table 狀況(臨時表狀況)

mysql > show status like "Create_tmp%";

Created_tmp_disk_tables/Created_tmp_tables比值最好不要超過10%,如果Created_tmp_tables值比較大,

可能是排序句子過多或者是連接句子不夠優化

(11) Binlog Cache 使用狀況

mysql > show status like "Binlog_cache%";

如果Binlog_cache_disk_use值不為0 ,可能需要調大 binlog_cache_size大小

(12) Innodb_log_waits 量

mysql > show status like "innodb_log_waits";

Innodb_log_waits值不等于0的話,表明 innodb log buffer 因為空間不足而等待

比如命令:

>#show global status;

雖然可以使用:

>#show global status like %...%;

來過濾,但是對應長長的list,每一項都代表什么意思,還是有必要弄清楚。

?

?

一,獲取mysql用戶下的進程總數

  ps -ef | awk '{print $1}' | grep "mysql" | grep -v "grep" | wc-1

  二,主機性能狀態

  # uptime

  [root@ ~]# uptime

  13:05:52 up 53 days, 52 min, 1 user, load average: 0.00, 0.00, 0.00

  三,CPU使用率

  # top

  或

  # vmstat

  四,磁盤IO量

  # vmstat 或 # iostat

  五,swap進出量[內存]

  # free

  六,數據庫性能狀態

  (1)QPS(每秒Query量)

  QPS = Questions(or Queries) / seconds

  mysql > show /*50000 global */ status like 'Question';

  (2)TPS(每秒事務量)

  TPS = (Com_commit + Com_rollback) / seconds

  mysql > show status like 'Com_commit';

  mysql > show status like 'Com_rollback';

  (3)key Buffer 命中率

  key_buffer_read_hits = (1-key_reads / key_read_requests) * 100%

  key_buffer_write_hits = (1-key_writes / key_write_requests) * 100%

  mysql> show status like 'Key%';

  (4)InnoDB Buffer命中率

  innodb_buffer_read_hits = (1 - innodb_buffer_pool_reads / innodb_buffer_pool_read_requests) * 100%

  mysql> show status like 'innodb_buffer_pool_read%';

  (5)Query Cache命中率

  Query_cache_hits = (Qcahce_hits / (Qcache_hits + Qcache_inserts )) * 100%;

  mysql> show status like 'Qcache%';

  (6)Table Cache狀態量

  mysql> show status like 'open%';

  (7)Thread Cache 命中率

  Thread_cache_hits = (1 - Threads_created / connections ) * 100%

  mysql> show status like 'Thread%';

  mysql> show status like 'Connections';

  (8)鎖定狀態

  mysql> show status like '%lock%';

  (9)復制延時量

  mysql > show slave status

  (10) Tmp Table 狀況(臨時表狀況)

  mysql > show status like 'Create_tmp%';

  (11) Binlog Cache 使用狀況

  mysql > show status like 'Binlog_cache%';

  (12) Innodb_log_waits 量

  mysql > show status like 'innodb_log_waits';

  開源監控軟件

  一,RRDTool

  二,Nagios

  三,MRTG

  四,Cacti

總結

以上是生活随笔為你收集整理的对正在运行的mysql进行监控的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。