MySQL效能监控工具mysqlreport安装部署及相关收集内容的解释说明

2017-01-09 19:20:58来源:作者:人点击

MySQL效能监控工具mysqlreport安装和中文说明管理 mysql 最让人困扰的就是如何有效的掌握 MySQL 的健康状况,因为 MySQL 虽然有提供许多系统变量值供您参考,但这些零散的数据若要手动搜集与过滤将会是一件十分没有效率的事情(除非您写 Scripts 去分析)。而接下来要介绍的这套 “工具” 其实是由 hackmysql.com 的站长所撰写的 perl Scritps,旨在协助 MySQL DBA 搜集与分析 MySQL 的运作状况。官方网站: http://hackmysql.com/
软件下载: http://hackmysql.com/mysqlreportmysqlreport以很友好的方式显示MySQL状态变化。事实上,它几乎报告了所有的状态。不像SHOW STATUS 只是在显示了100多个状态值,mysqlreport 则以人性化的方式阐释和格式化了这些状态值,大大增加了其可读性。mysqlreport 的好处是可以快速的查看各种状态参数组,从而了解服务器的运行状态情况,而无需从SHOW STATUS 的结果中人工计算。例如索引读取比率是个重要的参数,但是SHOW STATUS 中并没有显示;它是一个推断值(key_reads和 key_read_requests 的比值)。mysql命令行中经常使用下面的指令来获取当前数据库的实时状态:mysql>show status;
mysql>show innodb status;但是他们的显示结果不太友好,我们需要更好的更加人性化的分析结果,而不是堆出来一堆数字。mysqlreport是一个第三方的Mysql状态报告工具,它把mysql的show status 和 show innodb status的结果进行一系列的后期处理,让可读性更强,更友好。 下面是mysqlreport的安装过程:MySQLReport 是用perl语言编写,所以想要运行它首先需要安装perl环境;它还要与MySQL数据库连接,所以还需要安装数据库接口 DBI 和数据库驱动DBD-MySQL 。# perl-v //如果显示perl版本说明perl环境已经安装安装DBIyum -y installperl-DBI
或者# wgethttp://www.cpan.org/modules/by-module/DBI/DBI-1.634.tar.gz
# tar -zxf DBI-1.634.tar.gz
# cd DBI-1.634
# perl Makefile.PL
# make
# make test
# make
# makeinstall
安装DBD-mysql
yum -y installperl-DBD-MySQL
或者
# wget 
#' target='_blank'>http://search.cpan.org/CPAN/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.020.tar.gz
# tar zxvf DBD-mysql-4.020.tar.gz
# cd DBD-mysql-4.020
# perl Makefile.PL --mysql_config=/usr/local/mysql/bin/mysql_config
# make
# make test
如果报错:PERL_DL_NONLAZY=1 /usr/bin/perl"-MExtUtils::command::MM""-e""test_harness(0, 'blib/lib', 'blib/Arch')" t/*.t t/00base....................ok 1/6
# Failed test 'useDBD::mysql;' t/00base....................NOK 2
# in t/00base.t atline 21.
# Tried to use'DBD::mysql'.
# Error: Can'tload '/usr/local/src/DBD-mysql-4.020/blib/arch/auto/DBD/mysql/mysql.so' formodule DBD::mysql: libmysqlclient.so.16: cannot open shared object file: Nosuch file or directory at/usr/lib64/perl5/5.8.8/x86_64-Linux-thread-multi/DynaLoader.pm line 230.
# at (eval 6) line2 # Compilation failed in require at (eval 6) line 2.
# BEGINfailed--compilation aborted at t/00base.t line 21.
FAILED--Furthertesting stopped: Unable to load DBD::mysql make: *** [test_dynamic] Error 9 解决办法:# cp /usr/local/mysql/lib/mysql/*/usr/lib
# cp/usr/local/mysql/lib/mysql/* /usr/lib64/ (如果64位 否则是lib)
# make
# make install
安装mysqlreport
http://pkgs.fedoraproject.org/repo/pkgs/mysqlreport/mysqlreport-3.5.tgz/33a345f5e2c89b083a9ff0423f7fd7b4/mysqlreport-3.5.tgz
# wget 
#' target='_blank'>http://pkgs.fedoraproject.org/repo/pkgs/mysqlreport/mysqlreport-3.5.tgz/33a345f5e2c89b083a9ff0423f7fd7b4/mysqlreport-3.5.tgz
# tar -zxf mysqlreport-3.5.tgz
# cd mysqlreport-3.5
查看帮助:
# ./mysqlreport --help
mysqlreport v3.5 Apr 16 2008
mysqlreport makes an easy-to-read report of important MySQL status values.
Command line options (abbreviations work):
--user USER Connect to MySQL as USER
--password PASSUse PASS or prompt for MySQL user's password
--host ADDRESS Connect to MySQL at ADDRESS
--port PORT Connect to MySQL at PORT
--socket SOCKETConnect to MySQL at SOCKET
--no-mycnfDon't read ~/.my.cnf
--infile FILE  Read status values from FILE instead of MySQL
--outfile FILE Write report to FILE
--email ADDRESSEmail report to ADDRESS (doesn't work on Windows)
--flush-status Issue FLUSH STATUS; after getting current values
--relative XGenerate relative reports. If X is an integer,
reports are live from the MySQL server X seconds apart.
If X is a list of infiles (file1 file2 etc.),
reports are generated from the infiles in the order
that they are given.
--report-count N  Collect N number of live relative reports (default 1)
--detach  Fork and detach from terminal (run in background)
--helpPrints this
--debugPrint debugging information
Visit http://hackmysql.com/mysqlreport for more information.
收集命令如下:
[root@localhostmysqlreport-3.5]# pwd
/soft/tools/mysqlreport-3.5
[root@localhostmysqlreport-3.5]# ./mysqlreport --user root --password 123456 --socket/app/mysql-5.5.32/tmp/mysql.sock

收集相关内容解释说明参照如下文档: http://www.cnblogs.com/cnsanshao/archive/2013/02/28/2936903.html http://blog.csdn.net/xifeijian/article/details/19776667


本文出自 “一点点” 博客,请务必保留此出处http://pengai.blog.51cto.com/6326789/1890362

最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台