




已阅读5页,还剩23页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
MySQLMonitoring,ChinaUnix网友技术交流,MySQLMonitoring,一、如何有效监控?监控的目的二、基本监控解决方案(基础数据收集)三、高级解决方案(数据库健康状态,优化)四、MySQL性能相关交互式监控工具五、相关资源参考,一、如何有效监控?,一、如何有效监控?监控的目的?1、服务健康监测(存活,故障告警.)2、监控系统采集数据,依据数据进行调优,二、基本监控解决方案,二、基本监控解决方案(收集系统信息)top、vmstat、iostat、mpstat、mytop、dstata、free、/proc/.、mstat、mtop.命令行工具分析系统资源使用状况.,三、高级监控解决方案,三、高级监控解决方案1、Nagios相关:(收集数据库信息及健康状态,对数据库调整优化)check_mysql推荐nagios-mysql-plugins-0.3适当选择check_mysql_health重点介绍推荐由于时间关系本PPT只重点介绍一下Nagios相关的插件脚本.重点介绍一下check_mysql_health监控数据库调优。2、MySQLActivityReport基于rrdtool*http:/gert.sos.be/en/projects/mysqlar/*http:/gert.sos.be/demo/mysqlar/演示网站,三、高级监控解决方案,三、高级监控解决方案3、CACTI*MySQL模板:,Nagioscheck_mysql,#cd/usr/local/nagios/libexec/#./check_mysqlhelp/查看使用说明.Usage:check_mysql-ddatabase-Hhost-Pport-ssocket-uuser-ppassword-SOptions:-h,-helpPrintdetailedhelpscreen-V,-versionPrintversioninformation-H,-hostname=ADDRESSHostname,IPAddress,orunixsocket(mustbeanabsolutepath)-P,-port=INTEGERPortnumber(default:3306)-s,-socket=STRINGUsethespecifiedsocket(hasnoeffectif-Hisused)-d,-database=STRINGCheckdatabasewithindicatedname-u,-username=STRINGConnectusingtheindicatedusername-p,-password=STRINGUsetheindicatedpasswordtoauthenticatetheconnection=IMPORTANT:THISFORMOFAUTHENTICATIONISNOTSECURE!grantallprivileges-on*.*-tonetseek38identifiedbylinuxtone;QueryOK,0rowsaffected(0.00sec)mysqlflushprivileges;QueryOK,0rowsaffected(0.00sec),Nagioscheck_mysql,示例:在监控机上.#cd/usr/local/nagios/libexec/连接204查看数据库状态:#./check_mysql-H04-unetseek-plinuxtoneUptime:2146510Threads:1Questions:61155591Slowqueries:325Opens:1273Flushtables:1Opentables:767Queriespersecondavg:28.491连接数据库123查看./check_mysql-H23-unetseek-plinuxtone-S-w60-c600Uptime:35349Threads:1Questions:4022Slowqueries:0Opens:38Flushtables:1Opentables:32Queriespersecondavg:0.114SlaveIO:YesSlaveSQL:YesSecondsBehindMaster:0OK,在命令行下都能正常连接数据库:,Check_mysqlNagios配置,#vicommands.cfg添加如下:#check_mysqldefinecommandcommand_namecheck_mysqlcommand_line$USER1$/check_mysql-H$ARG1$-P$ARG2$-u$ARG3$-p$ARG4$/仔细看参数传递与上面的命令行对应.#check_slavedefinecommandcommand_namecheck_slavecommand_line$USER1$/check_mysql-H$ARG1$-P$ARG2$-u$ARG3$-p$ARG4$-S-w$ARG5$-c$ARG6$,Check_mysqlNagios配置,#vish-wt-www-db.cfg给上海网通两台DB服务器配置上mysql数据库检测:.在自己定的的配置文件里,添加如下服务段.#check_mysqldefineservicehost_namedbss-masterservice_descriptioncheck_mysqlcheck_commandcheck_mysql!22!3306!netseek!linuxtone.#checkslavedefineservicehost_namedbss-slaveservice_descriptioncheck_slavecheck_commandcheck_slave!23!3306!netseek!linuxtone!60!600.,Nagioscheck_mysql,check_mysql监控演示效果Check_mysqlS模块可以很好的检测mysqlreplicationslave的健康状态.mysqlshowslavestautsG*是否工作Slave_IO_running:YESSlave_SQL_running:YES*延迟情况Sencodes_behind_master,nagios-mysql-plugins,选择性的使用此插件来配合监控工作#wgethttp:/www.shinguz.ch/MySQL/nagios-mysql-plugins-0.3.tar.gz#tarzxvfnagios-mysql-plugins-0.3.tar.gz#cdnagios-mysql-plugins-0.3#chmoda+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_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-h04-unetseek-plinuxtone-port3306编写commanddefinecommandcommand_namecheck_db_mysqlcommand_line$USER1$/check_db_mysql.pl-h$ARG1$-u$ARG2$-p$ARG3$-port$ARG4$.服务端配置:.check_commandcheck_db_mysql!04!netseek!linuxtone!3306.,check_mysql_health,一、安装check_mysql_health官方网站:http:/www.consol.de/opensource/nagios/check-mysql-health/#wgethttp:/www.consol.de/fileadmin/opensource/Nagios/check_mysql_health-2.0.3.tar.gz#tarzxvfcheck_mysql_health-2.0.3.tar.gz#cdcheck_mysql_health-2.0.3#./configure-prefix=/usr/local/nagios-with-nagios-user=nagios-with-nagios-group=nagios-with-perl-with-statefiles-dir=/tmp#makeQueryOK,0rowsaffected(0.00sec)mysqlflushprivileges;QueryOK,0rowsaffected(0.00sec)OK-2clientconnectionthreads|threads_connected=2;10;20,check_mysql_health,三、示例:在监控机上.#cd/usr/local/nagios/libexec/连接123查看数据库查询线程缓存命中率状态:#./check_mysql_health-hostname23-port3306-usernamenetseek-passwordlinuxtone-modethreadcache-hitrateOK-threadcachehitrate91.30%|thread_cache_hitrate=91.30%;90:;80:thread_cache_hitrate_now=91.30%connections_per_sec=0.0090:表示小于90warning,80表示小于80则critical查询命中率#./check_mysql_health-hostname22-port3306-usernamenetseek-passwordlinuxtone-modeqcache-hitrateWARNING-querycachehitrate88.19%|qcache_hitrate=88.19%;90:;80:qcache_hitrate_now=78.57%selects_per_sec=0.75,check_mysql_health,三、示例:在监控机上.调整告警阀值:#./check_mysql_health-hostname22-port3306-usernamenetseek-passwordlinuxtone-w80:-c70:-modeqcache-hitrateOK-querycachehitrate88.19%|qcache_hitrate=88.19%;80:;70:qcache_hitrate_now=85.63%selects_per_sec=0.52连接123数据库查看锁表率.#./check_mysql_health-hostname23-port3306-usernamenetseek-passwordlinuxtone-modetable-lock-contentionOK-tablelockcontention0.00%|tablelock_contention=0.00%;1;2tablelock_contention_now=0.00%连接123数据库查看数据库服务器当前连接数量:#./check_mysql_health-hostname23-port3306-usernamenetseek-passwordlinuxtone-modethreads-connectedOK-2clientconnectionthreads|threads_connected=2;10;20,check_mysql_health,Nagios相关配置#vicommands.cfg添加如下:#check_health_mysqldefinecommandcommand_namecheck_mysql_healthcommand_line$USER1$/check_mysql_health-hostname$ARG1$-port$ARG2$-username$ARG3$-password$ARG4$-mode$ARG5$#vish-wt-www-db.cfg给上海网通两台DB服务器配置上mysql数据库检测:.在自己定的的配置文件里,添加如下服务段.defineservicehost_namedbss-slaveservice_descriptionthreads-connectedcheck_com
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 地理高考试题及答案
- 事业编中医护理考试题库及答案
- 守秘性及信息安全保障承诺书4篇范文
- 团队协作项目计划与时间管理模板
- 跨部门合作协调表模板流程与责任明确
- 企业组织结构调整过渡方案制定表
- 市场营销策略规划工具精准定位市场趋势
- 智能传感器技术承诺书4篇
- 特种安全培训模板课件
- 《几何图形变换证明技巧实践课》
- 耳前瘘管继发感染诊疗要点
- T-YNX 002-2025 葡萄组培脱毒快繁技术规程
- 衣服投标供货方案(3篇)
- 公司电脑补贴管理办法
- 中石化对供应商管理办法
- Unit 2 Home Sweet Home 语法与阅读专项练习 (含答案) 人教版(2024)八年级上册
- 2025版安全生产法全文
- 《山居秋暝》(王维)测试题带答案
- 甲状腺肿瘤的早期诊断与治疗进展
- 中央政府投资项目后评价报告编制大纲()(发改投资20252129号)
- 绿化部门车辆管理制度
评论
0/150
提交评论