Mysql管理必备工具Maatkit详解之一(安装Maatkit)
2009年05月15日 作者: 大头刚
Maatkit是一个Perl写的Mysql开源管理工具,根据调查全球大约有70%多的Mysql管理员使用这个工具来管理Mysql,但我发现在国内很少有人知道这个工具,因此打算写一个系列的文章来介绍这个工具,并带上自己的心得和一些体会。
首先安装Maatkt,需要Perl,DBI,DBD::mysql相关模块。
1.perl
perl -v This is perl, v5.8.5 built for i386-linux-thread-multi Copyright 1987-2004, Larry Wall 一般linux安装的时候默认安装了perl。
2.Mysql 可以到这里下载
Mysql的安装网上到处都是,就省略了。
3.DBI,可以到这里下载相应的版本
tar zxf DBI-1.58.tar.gz cd DBI-1.58 perl Makefile.pl make make test make make install
4.data-showtable包,可以到这里下载查找相应的包
gzip -c -d Data-ShowTable-?.??.tar.gz | tar xvf - cd Data-ShowTable-?.?? perl Makefile.PL make 不要试make test,测试套件损坏了! make install
5.msql-mysql-modules 可以到这里下载
gzip -c -d Msql-Mysql-modules-?.??.tar.gz | tar xvf -
将压缩文件接压缩到一个名为Msql-Mysql-modules-?.??的目录。
cd Msql-Mysql-modules-?.?? perl Makefile.PL 在 "perl Makefile.PL" 期间,会向你提出一些问题。特别是你必须选择安装驱动器(MySQL, mSQL2 and/or mSQL1)。MySQL驱动程序叫 DBD::mysql,单独的mSQL驱动程序叫DBD::mSQL。如果你想支持mSQL1和mSQL2,用DBD::mSQL1。 make make test make install
6.DBD-mysql 可以到这里下载
安装DBD: DBD-mysql-4.005 perl Makefile.PL --mysql_config=/usr/local/mysql/bin/mysql_config make make test make make install 如果出现以下错误, install_driver(mysql) failed: Can't load '/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBD/mysql/mysql.so' for module DBD::mysql: libmysqlclient.so.12: cannot open shared object file: No such file or directory at /usr/lib/perl5/5.8.5/i386-linux-thread-multi/DynaLoader.pm line 230. at (eval 6) line 3 Compilation failed in require at (eval 6) line 3. Perhaps a required shared library or dll isn't installed where expected at /root/mysqlreport line 162 就做操作 cp /usr/local/mysql/include/mysql* /usr/include/ cp /usr/local/mysql/lib/* /usr/lib/ (64位的是lib64) 然后再重新安装DBD: DBD-mysql-4.005 perl Makefile.PL --mysql_config=/usr/local/mysql/bin/mysql_config make make test make install
7.安装maatkit 可以到这里下载
tar zxvf maatkit-2325.tar.gz cd maatkit-2325 perl Makefile.PL make install
下面分别列出这套工具,以及官方的定义,在后续的文章中,会分别对这些工具进行介绍,以及自己的测试和心得体会。
mk-archiver Archive rows from a MySQL table into another table or a file.
mk-audit Analyze, summarize and report on MySQL config, schema and operation
mk-checksum-filter Filter checksums from mk-table-checksum.
mk-deadlock-logger Extract and log MySQL deadlock information.
mk-duplicate-key-checker Find duplicate keys and foreign keys on MySQL tables.
mk-fifo-split Split files and pipe lines to a fifo without really splitting.
mk-find Find MySQL tables and execute actions, like GNU find.
mk-heartbeat Monitor MySQL replication delay.
mk-log-player Split and play MySQL slow logs.
mk-log-server Serve MySQL binary logs.
mk-parallel-dump Dump sets of MySQL tables in parallel.
mk-parallel-restore Load files into MySQL in parallel.
mk-profile-compact Compact the output from mk-query-profiler.
mk-query-digest Parses logs and more. Analyze, transform, filter, review and report on queries.
mk-query-profiler Execute SQL statements and print statistics, or measure activity caused by other processes.
mk-show-grants Canonicalize and print MySQL grants so you can effectively replicate, compare and version-control them.
mk-slave-delay Make a MySQL slave server lag behind its master.
mk-slave-find Find and print replication hierarchy tree of MySQL slaves.
mk-slave-move Move a MySQL slave around in the replication hierarchy.
mk-slave-prefetch Pipeline relay logs on a MySQL slave to pre-warm caches.
mk-slave-restart Watch and restart MySQL replication after errors.
mk-table-checksum Perform an online replication consistency check, or checksum MySQL tables efficiently on one or many servers.
mk-table-sync Synchronize MySQL tables efficiently.
mk-visual-explain Format EXPLAIN output as a tree.




- Comments (0)
- Trackbacks (14)
Leave a comment Trackback