Percona Toolkit is a set of advanced command-line toolsets for managing MySQL and system tasks, mainly including:
1, master and slave status detection and repair
2. Detection of delay from library replication
3, slow query, log analysis
4. detecting MySQL Server Status
5. Detection from logs and tcpdump
1. Installing Perl related modules
Yum Install PERL-DBI
Yum Install Perl-dbd-mysql
Yum Install Perl-time-hires
Yum Install Perl-io-socket-ssl
2, download and install per-dependency package, Percona Toolkit Package
wget http://pkgs.repoforge.org/perl-TermReadKey/perl-TermReadKey-2.30-1.el3.rf.x86_64.rpm
RPM-IVH perl-termreadkey-2.30-1.el3.rf.x86_64.rpm
wget https://www.percona.com/downloads/percona-toolkit/2.2.14/RPM/percona-toolkit-2.2.14-1.noarch.rpm rpm -ivh percona-toolkit-2.2.14-1.noarch.rpm
Use
Server Summary
Pt-summary
Server disk Monitoring
Pt-diskstats
MySQL Service Status summary
Pt-mysql-summary----User=root--password=root
Slow Query Log Analysis statistics
Pt-query-digest/data/logs/mysql/mysql-slow.log
Table Sync Tool, like the Mk-tables-sync function, is there a slight difference in usage?, –print results more detailed
Pt-table-sync--execute--print--no-check-slave--database=world h= ' 127.0.0.1 '--user=root--password=123456 h= ' 192.168.0.212 '--user=root--password=123456
Master-Slave status monitoring, provided to it a MySQL server IP user name password, you can analyze the entire master-slave architecture of each server information, including but not limited to MySQL version, IP address, server Id,mysql service startup time, role (master/slave), Slave Status (lag behind the primary server for how many seconds, there are no errors, slave is not running).
[Email protected] ~]# pt-slave-find--host=localhost--user=rhce6--password=rhce6
localhost
Version 5.5.23-log
Server ID 1
Uptime 05:16:10 (started 2012-08-08t09:32:03)
Replication is not a slave, have 1 slaves connected, is not read_only
Filters
Binary Logging STATEMENT
Slave status
Slave Mode STRICT
Auto-increment increment 1, offset 1
InnoDB version 1.1.8
+-192.168.0.168
Version 5.5.23-log
Server ID 10
Uptime 38:19 (started 2012-08-08t14:09:54)
Replication is a slave, have 0 slaves connected, is not read_only
Filters
Binary Logging STATEMENT
Slave status 0 seconds behind, running, no errors
Slave Mode STRICT
Auto-increment increment 1, offset 1
InnoDB version 1.1.8
MySQL Deadlock monitoring
Pt-deadlock-logger h= ' 127.0.0.1 '--user=root--password=123456
Primary key conflict Check
Pt-duplicate-key-checker--database=world h= ' 127.0.0.1 '--user=root--password=123456
Monitoring replication latency from the library??? # # #经过测试? Running this command causes an exception to be dropped from the SQL thread on the library
Pt-slave-delay--host 192.168.0.206--user=root--password=123456
Mysql--percona-toolkit Command Line Toolset