pt calibration tool master data consistency from the embodiment dsns

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.

create database pt;
CREATE TABLE `pt`.`dsns` ( `id` int(11) NOT NULL AUTO_INCREMENT, `parent_id` int(11) DEFAULT NULL, `dsn` varchar(255) NOT NULL, PRIMARY KEY (`id`) );

+----+-----------+-----------------------------------------+
| id | parent_id | dsn |
+----+-----------+-----------------------------------------+
| 1 | 1 | h=192.168.11.73,u=chen,p=asd.123,P=3307 |
+----+-----------+-----------------------------------------+

Mainly dsn this field: there is a connection from the repository, if the primary user login from, like, just write: h = 192.168.11.73, P = 3307 on the line.
 
Besides recursion-method parameters:
--recursion-method "dsn=D=pt,t=dsns,h=192.168.11.92,u=op_dba,p=vqR9cGbEwKNuvy4Z"
This parameter is the connection information of the server dsns table, my order are: databases, tables, server IP, user, password; of course, if dsns table on the primary server, just write dsn = D = pt, t = dsns on the line .
 
The two main needs attention, a lot of other online, you can find yourself.
Finally, to complete a command, which I used, but did not include all items:

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

 
 

Guess you like

Origin www.cnblogs.com/nandi001/p/11502278.html