MySQL management tool --- Percona Toolkit is a group of advanced command line tools used to manage MySQL and system tasks, including: 1. Verify the consistency between the master node and the replicated data. 2. Effectively archive record rows. 3. Find duplicate indexes. 4. Summarize MySQL server. 5. Analyze and query logs and tcpdump. 6, collect important system information when a problem occurs. Install PT:
yum install -y perl-CPAN perl-Time-HiRes wget http://www.percona.com/downloads/percona-toolkit/LATEST/percona-toolkit-2.1.3-2.noarch.rpm yum install -y percona-toolkit-2.1.3-2.noarch.rpm
Install the tool in the/usr/bin1_tar.gz package
wget http://www.percona.com/redir/downloads/percona-toolkit/LATEST/percona-toolkit-2.1.3.tar.gz tar zxf percona-toolkit-2.1.3.tar.gz cd percona-toolkit-2.1.3 perl Makefile.PL make make install
The tool installation directory is:/usr/local/bin common tool set:
1. Server summary pt-summary 2. server disk monitoring pt-diskstats 3. mysql Service Status summary pt-mysql-summary -- user = root -- password = root 4. Slow query logs analysis Statistics pt-query-digest/data/logs/mysql/mysql-slow.log 5, table synchronization tools, similar to mk-tables-sync, the usage is slightly different, -- print results more detailed pt-table-sync -- execute -- print -- no-check-slave -- database = world h = '2017. 0.0.1 '-- user = root -- password = 123456 h = '2017. 168.0.212 '-- user = root -- password = 123456 6. Monitor the master/slave status and provide it with the IP address password of a mysql server. You can analyze the information of each server in the master-slave architecture, including but not limited to the mysql version, IP address, server ID, and mysql service start time, role (Master/Slave) and slave Status (the number of seconds behind the master server, whether there are errors, and whether the Slave is running ). [Root @ RHCE6 ~] # 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, has 1 slaves connected, is not read_only Filters Binary logging STATEMENT Slave status Slave mode STRICT Auto-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, has 0 slaves connected, is not read_only Filters Binary logging STATEMENT Slave status 0 seconds behind, running, no errors Slave mode STRICT Auto-increment 1, offset 1 InnoDB version 1.1.8 7. mysql deadlock monitoring pt-deadlock-logger h = '2017. 0.0.1 '-- user = root -- password = 123456 8. primary key conflict check pt-duplicate-key-checker -- database = world h = '2017. 0.0.1 '-- user = root -- password = 123456 9. monitor slave Database Replication latency ### run the test command to cause the SQL thread on the slave database to crash pt-slave-delay -- host 192.168.0.206 -- user = root -- password = 123456