对正在运行的mysql进行监控
2015-07-06 00:41
731 查看
对正在运行的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
(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监控】查看mysql库大小,表大小,索引大小
- Windows下Mysql5.6启用监控执行脚本的日志
- 实时监控MySql状态
- 实时监控mysql数据库变化
- CentOS+nginx+Django+Postgresql web环境搭建
- golang自定义数据类型查询与插入postgresql中point数据
- 关于SQL Server监控与优化
- MySQL-Cluster架构图文详解
- SQL Server 2008 R2 安装出错:Could not open key
- PL/SQL developer配置方法
- SQL2008代理作业出现错误: c001f011维护计划创建失败的解决方法
- Oracle SQL Developer更改DATE日期的显示格式
- CRITICAL keystone [-] OperationalError: (OperationalError) (2003, "Can't connect to MySQL server on
- 关于PL/SQL Developer 中文乱码的解决
- beego框架之orm模块——PostgreSQL
- C#/Sqlite-SQLite PetaPoco django 打造桌面程序
- MySQL导入sql脚本错误:2006 - MySQL server has gone away
- beego框架之orm模块——sqlite
- SQL SERVER 2005/2008 中关于架构的理解(一)
- 20150702-CitrixXenDesktop-SQL Server