Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1084516
  • 博文数量: 646
  • 博客积分: 288
  • 博客等级: 二等列兵
  • 技术积分: 5375
  • 用 户 组: 普通用户
  • 注册时间: 2010-07-08 14:33
个人简介

为了技术,我不会停下学习的脚步,我相信我还能走二十年。

文章分类

全部博文(646)

文章存档

2014年(8)

2013年(134)

2012年(504)

分类:

2012-07-24 16:16:21

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

 

下面分别列出这套工具,以及官方的定义,在后续的文章中,会分别对这些工具进行介绍,以及自己的测试和心得体会。
Archive rows from a MySQL table into another table or a file.
Analyze, summarize and report on MySQL config, schema and operation
mk-checksum-filter Filter checksums from mk-table-checksum.
Extract and log MySQL deadlock information.
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.

  • mk-archiver 将表数据清除或归档到另外的表或文件
  • mk-audit 分析MySQL的配置,概要,操作, 生成报表
  • mk-checksum-filter mk-table-checksum的过滤器
  • mk-deadlock-logger 记录InnoDB的死锁信息
  • mk-duplicate-key-checker 查找重复或冗余的外键和索引
  • mk-fifo-split 将一个文件拆分为多个部分, 输出到FIFO管道(有用吗?)
  • mk-find 按指定规则查找表名, 然后执行操作
  • mk-heartbeat 监视数据库之间复制的延迟
  • mk-log-player 拆分并重演慢速查询日志
  • mk-parallel-dump 多线程导出
  • mk-parallel-restore 多线程导入
  • mk-profile-compact 压缩mk-query-profiler输出
  • mk-query-digest 分析日志
  • mk-query-profiler 查询性能分析工具
  • mk-show-grants 显示用户权限
  • mk-slave-delay 实现备库与主库之间一定的延时
  • mk-slave-find 查找/显示出备库的树型层次结构
  • mk-slave-move 在层次结构中移动备库(什么玩意?)
  • mk-slave-prefetch 在备库上运行SELECT查询语句, 使数据预读取到内存中
  • mk-slave-restart 监测备库发生的错误并重启
  • mk-table-checksum 快速检测两个表的数据是否相同. 可以用来检测备库和主库的数据一致性
  • mk-table-sync 发现并修复不同服务器上的两个表之间的数据差异
  • mk-upgrade 比较2个数据库中语句的运行结果
  • mk-visual-explain 以树形显示执行计划
  • 阅读(442) | 评论(0) | 转发(0) |
    给主人留下些什么吧!~~