mysql consistency check data from the master, commonly used method is Percona-Toolkit component pt-table-checksum, this thing is how to use the Internet a lot, not long-winded. Mainly talk about finding a way from the library by dsns way.
pt tools after connecting to the main library, the default yes yes, show processlist get through the main thread from copying information from the library, and then connect from the library. Default connection from the library has his limitations, can not use the following scenario:
Scenes:
1. The non-standard port 3306, or inconsistencies from the main port;
2. Copy the master source from the multiple built;
3. Ali cloud, Tencent cloud from the main relationship, unable to obtain information directly from the library;
By dsns connected from the library, only we need to focus on two things:
1.dsns table;
Parameter 2.recursion-method;
Let me talk dsns table, the table structure is as follows:
This table can be build on any server, as long as that can be accessed on the trip, I used to be such a tool on the master control server, then this server manages all mysql database.
+----+-----------+-----------------------------------------+
| id | parent_id | dsn |
+----+-----------+-----------------------------------------+
| 1 | 1 | h=192.168.11.73,u=chen,p=asd.123,P=3307 |
+----+-----------+-----------------------------------------+
pt-table-checksum --host='192.168.11.73' --user='check' --password='asd.123' --port=3306
--create-replicate-table --databases="jxbbs" --tables="im_group_msg"
--no-check-binlog-format --recursion-method "dsn=D=pt,t=dsns,h=192.168.11.92,u=op_dba,p=vqR9cGbEwKNuvy4Z"
--recurse=1 --nocheck-replication-filters --replicate-check