运行中的mysql状态的查看方法

28次阅读
没有评论

共计 1705 个字符,预计需要花费 5 分钟才能阅读完成。

本篇内容介绍了“运行中的 mysql 状态的查看方法”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让丸趣 TV 小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

对正在运行的 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 状态的查看方法”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注丸趣 TV 网站,丸趣 TV 小编将为大家输出更多高质量的实用文章!

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-08-01发表,共计1705字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)