一款开源的监控MYSQL性能的工具—INNOTOP(转载)

上一篇 / 下一篇  2009-08-19 11:28:50 / 个人分类:Mysql

INNOTOP是一个通过文本模式显示MySQL和InnoDB的监测工具。它有很多特点,快速的配置的,易于使用等。它吸取了MYTOP的精华这使它变得更加强大。INNOTOP是用PERL语言写成的,这是它能更加灵活的使用在各种操作平台之上,它能详细的的监控出当前MYSQL和INNODB运行的状态,以便维护人员根据结果合理的优化MYSQL,让MYSQL更稳定更高效的运行。

安装INNOTOP工具非常的简单,既然是由PERL写的,当然需要PERL环境和相关的工具包。

在安装之前先要确定你的系统安装了Time::HiRes,Term::ReadKey,DBI,DBD::mysql这四个包。安装可以把包下载下来通过编译安装完成也可以用PERL模块安装方式来完成。

安装Time::HiRes,Term::ReadKey,DBI,DBD::mysql库文件

通过PERL模块来安装

[root@web1477 local]# perl -MCPAN -eshell

CPAN> install Time::HiRes

CPAN> install Term::ReadKey

CPAN> install DBI

CPAN> install DBD::mysql

通过编译来安装

[root@web1477 tmp]# tar zxvf Time-HiRes-01.20.tar

[root@web1477 tmp]# cd Time-HiRes-01.20

[root@web1477 Time-HiRes-01.20]# perl Makefile.PL

[root@web1477 Time-HiRes-01.20]# make

[root@web1477 Time-HiRes-01.20]# make install

其他三个库文件也如法炮制。环境安装好了就可以开始安装INNOTOP软件了。

[root@web1477 local]# tar zxvf innotop-1.6.0.tar.gz

[root@web1477 local]# ln -s innotop-1.6.0/ innotop

[root@web1477 local]# cd innotop

[root@web1477 innotop]# perl Makefile.PL

Checking if your kit is complete…

Looks good

Writing Makefile for innotop

[root@web1477 innotop]# make

cp InnoDBParser.pm blib/lib/InnoDBParser.pm

cp innotop blib/script/innotop

/usr/bin/perl “-MExtUtils::MY” -e “MY->fixin(shift)” blib/script/innotop

Manifying blib/man1/innotop.1

Manifying blib/man3/InnoDBParser.3

[root@web1477 innotop]# make install

Installing /usr/lib/perl5/5.8.8/html/site/lib/InnoDBParser.html

Installing /usr/lib/perl5/5.8.8/html/bin/innotop.html

Installing /usr/lib/perl5/5.8.8/site/lib/InnoDBParser.pm

Installing /usr/lib/perl5/5.8.8/site/man/man1/innotop.1

Installing /usr/lib/perl5/5.8.8/site/man/man3/InnoDBParser.3

Installing /usr/lib/perl5/5.8.8/site/bin/innotop

Appending installation info to /usr/lib/perl5/5.8.8/lib/perllocal.pod

[root@web1477 innotop]#

安装完成了,下面就是要开始设置它

[root@web1477 innotop]# ./innotp

You have not defined any database connections.

Choose a name for the connection. It cannot contain whitespace, colons or semicolons.

Enter a name: localhost

Typical DSN strings look like

  DBI:mysql:;host=hostname;port=port

The db and port are optional and can usually be omitted.

If you specify ‘mysql_read_default_group=mysql’ many options can be read

from your mysql options files (~/.my.cnf, /etc/my.cnf).

Enter a DSN string: DBI:mysql:;mysql_read_default_group=mysql;host=localhost

 Optional: enter a table (must not exist) to use when resetting InnoDB deadlock information: test.innotop_dl 

 Do you want to specify a username for localhost?: y

 Do you want to specify a password for localhost?: y

 Enter username for localhost: root

Enter password for ‘root’ on localhost:

Save password in plain text in the config file?: y

完成这些INNOTOP就可以开始工作了。

# ./innotop

uery List (? for help)                                                        localhost, 23+12:35:18, 0.30 QPS, 22 thd, 5.0.45-log

 

CXN       When  Load QPS    Slow   QCacheHit KCacheHit BpsIn  BpsOut

localhost Now   0.73   0.30  0         0.00%   100.00%   9.47   1.41k

localhost Total 0.00 329.49 11.50k    67.13%    99.86% 486.35 774.07

 

CXN    Cmd   ID     User  Host          DB     Time  Query

INNOTOP查看各种监控状态的命令

Switch to a different mode:

  B InnoDB Buffers   I InnoDB I/O Info    Q Query List

  C Command Summary  L Locks              R InnoDB Row Ops

  D InnoDB Deadlocks M Replication Status S Variables & Status

  F InnoDB FK Err    O Open Tables        T InnoDB Txns

Actions:

  d Change refresh interval           p Pause innotop

  i Toggle incremental status display q Quit innotop

  n Switch to the next connection     

Other:

 TAB Switch to the next server group  / Quickly filter what you see

  ! Show license and warranty        = Toggle aggregation

  # Select/create server groups      @ Select/create server connections

  $ Edit configuration settings      \ Clear quick-filters

Press any key to continue

如何获得INNOTOP软件呢?

你可以到http://innotop.sourceforge.net/去下载,因为GW屏蔽了国外某些站点,但是可以通过其他的代理连接上去下载。另外你可以通过

wget http://nchc.dl.sourceforge.net/sourceforge/innotop/innotop-1.6.0.tar.gz直接下载该软件。


TAG:

 

评分:0

我来说两句

Open Toolbar