Installation notes
Percona Toolkit 3.2.0 on CentOS 7.4
Configuring Percona Repositories with percona-release
Installing Percona Toolkit
#!/bin/sh # Add warehouse yum install https://repo.percona.com/yum/percona-release-latest.noarch.rpm # Perform installation yum install percona-toolkit-3.2.0
Documents that need to be read before using the tool
How to specify DSN parameters: DSN (DATA SOURCE NAME) SPECIFICATIONS
Environment variables that control tool behavior: ENVIRONMENT
Command introduction
pt-table-checksum-verify replication consistency
Principles and features:
1) Use REPLACE..SELECT query, calculate CRC to check data consistency (use pt-table-checksum --explain to view details);
2) Divide data into multiple blocks according to index (or primary key). If the data table does not contain an index and contains a small amount of data, the tool will check the table as a single block;
Notes:
1) Since checks in block units only when the same number of rows but the checksums differ when, in order to conclude that there is inconsistent row contents.
pt-table-sync-synchronize data between tables
Principles and characteristics:
1) Execute the difference statement on the main library (without changing the data), and then use the master-slave replication to synchronize the data to the slave library.
Note:
1) Before synchronization, you should use --dry-run and --print for testing;
2) This tool will not synchronize table structures, indexes and other objects;
pt-heartbeat-detect replication delay
Principles and characteristics:
1) Insert data in the main library, and record and insert a time stamp in the data;
2) Read data from the slave library and compare the time stamp with the current system time