mysql运行监控全解.ppt
《mysql运行监控全解.ppt》由会员分享,可在线阅读,更多相关《mysql运行监控全解.ppt(28页珍藏版)》请在三一办公上搜索。
1、MySQL Monitoring,ChinaUnix网友技术交流,MySQL Monitoring,一、如何有效监控?监控的目的 二、基本监控解决方案(基础数据收集)三、高级解决方案(数据库健康状态,优化)四、MySQL性能相关交互式监控工具 五、相关资源参考,一、如何有效监控?,一、如何有效监控?监控的目的?1、服务健康监测(存活,故障告警.)2、监控系统采集数据,依据数据进行调优,二、基本监控解决方案,二、基本监控解决方案(收集系统信息)top、vmstat、iostat、mpstat、mytop、dstata、free、/proc/.、mstat、mtop.命令行工具分析系统资源使用状况
2、.,三、高级监控解决方案,三、高级监控解决方案 1、Nagios相关:(收集数据库信息及健康状态,对数据库调整优化)check_mysql 推荐 nagios-mysql-plugins-0.3 适当选择 check_mysql_health 重点介绍推荐 由于时间关系本PPT只重点介绍一下Nagios相关的插件脚本.重点介绍一下check_mysql_health监控数据库调优。2、MySQL Activity Report 基于rrdtool*http:/*http:/演示网站,三、高级监控解决方案,三、高级监控解决方案 3、CACTI*MySQL模板 4、RRD 参考资料:*http:/
3、*http:/www.fi.muni.cz/kas/mrtg-rrd/*http:/5、Munin*http:/.,Nagios check_mysql,#cd/usr/local/nagios/libexec/#./check_mysql help/查看使用说明.Usage:check_mysql-d database-H host-P port-s socket-u user-p password-SOptions:-h,-help Print detailed help screen-V,-version Print version information-H,-hostname=ADD
4、RESS Host name,IP Address,or unix socket(must be an absolute path)-P,-port=INTEGER Port number(default:3306)-s,-socket=STRING Use the specified socket(has no effect if-H is used)-d,-database=STRING Check database with indicated name-u,-username=STRING Connect using the indicated username-p,-password
5、=STRING Use the indicated password to authenticate the connection=IMPORTANT:THIS FORM OF AUTHENTICATION IS NOT SECURE!=Your clear-text password could be visible as a process table entry-S,-check-slave/检测Slave状态.Check if the slave thread is running properly.-w,-warning Exit with WARNING status if sla
6、ve server is more than INTEGER seconds behind master-c,-critical Exit with CRITICAL status if slave server is more then INTEGER seconds behind master,Nagios check_mysql,示例:Nagios 监控服务器如要监控DB服务器和Slave DB服务器数据库授权:(登陆DB服务器,进行授权用户名netseek,密码linuxtone)mysql grant all privileges-on*.*-to netseek192.168.16
7、9.138 identified by linuxtone;Query OK,0 rows affected(0.00 sec)mysql flush privileges;Query OK,0 rows affected(0.00 sec),Nagios check_mysql,示例:在监控机上.#cd/usr/local/nagios/libexec/连接204查看数据库状态:#./check_mysql-H-u netseek-p linuxtoneUptime:2146510 Threads:1 Questions:61155591 Slow queries:325 Opens:127
8、3 Flush tables:1 Open tables:767 Queries per second avg:28.491连接数据库123查看./check_mysql-H 192.168.169.123-u netseek-p linuxtone-S-w 60-c 600Uptime:35349 Threads:1 Questions:4022 Slow queries:0 Opens:38 Flush tables:1 Open tables:32 Queries per second avg:0.114 Slave IO:Yes Slave SQL:Yes Seconds Behind
9、 Master:0OK,在命令行下都能正常连接数据库:,Check_mysql Nagios配置,#vi commands.cfg 添加如下:#check_mysqldefine command command_name check_mysql command_line$USER1$/check_mysql-H$ARG1$-P$ARG2$-u$ARG3$-p$ARG4$/仔细看参数传递与上面的命令行对应.#check_slavedefine command command_name check_slave command_line$USER1$/check_mysql-H$ARG1$-P$AR
10、G2$-u$ARG3$-p$ARG4$-S-w$ARG5$-c$ARG6$,Check_mysql Nagios配置,#vi sh-wt-www-db.cfg 给上海网通两台DB服务器配置上mysql数据库检测:.在自己定的的配置文件里,添加如下服务段.#check_mysqldefine service host_name dbss-master service_description check_mysql check_command check_mysql!3306!netseek!linuxtone.#check slavedefine service host_name dbss-s
11、lave service_description check_slave check_command check_slave!192.168.169.123!3306!netseek!linuxtone!60!600.,Nagios check_mysql,check_mysql监控演示效果Check_mysql S 模块可以很好的检测mysql replication slave的健康状态.mysqlshow slave stautsG*是否工作 Slave_IO_running:YES Slave_SQL_running:YES*延迟情况 Sencodes_behind_master,na
12、gios-mysql-plugins,选择性的使用此插件来配合监控工作#wget#tar zxvf#cd nagios-mysql-plugins-0.3#chmod a+x*#mv*/usr/local/nagios/libexec插件解释:check_db_mysql.pl 检测mysql是否运行.check_errorlog_mysql.pl 检测数据库下的错误日志perf_mysql.pl 收集性能数据,类似后面要讲的check_mysql_healthreplication相关.check_repl_mysql_cnt_slave_hosts.pl/检测复制相关。check_repl
13、_mysql_hearbeat.plcheck_repl_mysql_io_thread.plcheck_repl_mysql_read_exec_pos.plcheck_repl_mysql_readonly.plcheck_repl_mysql_seconds_behind_master.plcheck_repl_mysql_sql_thread.pl-,nagios-mysql-plugins,./check_db_mysql.pl-h-u netseek-p linuxtone-port 3306编写command define command command_name check_d
14、b_mysql command_line$USER1$/check_db_mysql.pl-h$ARG1$-u$ARG2$-p$ARG3$-port$ARG4$.服务端配置:.check_command check_db_mysql!netseek!linuxtone!3306.,check_mysql_health,一、安装check_mysql_health 官方网站:/#wget#tar zxvf#cd#./configure-prefix=/usr/local/nagios-with-nagios-user=nagios-with-nagios-group=nagios-with-pe
15、rl-with-statefiles-dir=/tmp#make&make install 注:check_mysql_health(check_mysql_perf的替代方案,官方不再支持 check_mysql_perf)详细参见:,check_mysql_health,二、check_mysql_health 插件使用说明#cd/usr/local/nagios/libexec/#./check_mysql_health-help Check various parameters of MySQL databases Usage:check_mysql_health-v-t-hostna
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- mysql 运行 监控
![提示](https://www.31ppt.com/images/bang_tan.gif)
链接地址:https://www.31ppt.com/p-5441092.html