针对于某一张表sync
[rrd199@mysqldbmaster shells]$ pt-table-checksum u='checksums',p='checksums',P=3306 -d renrendai_0513 --tables=point --nocheck-replication-filters --create-replicate-table --replicate=renrendai_0513.checksums ;
Cannot connect to P=3306,h=192.168.1.13,p=...,u=checksums
Cannot connect to P=3306,h=192.168.1.12,p=...,u=checksums
Cannot connect to P=3306,h=192.168.1.14,p=...,u=checksums
TS ERRORS DIFFS ROWS CHUNKS SKIPPED TIME TABLE
04-21T16:11:55 0 1 706673 7 0 3.000 renrendai_0513.point
发现不同步;查看需要同步的项目
[rrd199@mysqldbmaster shells]$ pt-table-sync --print --replicate renrendai_0513.checksums --sync-to-master --databases=renrendai_0513,--tables=point, h=192.168.1.41,P=3306,u=checksums,p=checksums
REPLACE INTO `renrendai_0513`.`point`(`pointid`, `availablepoints`, `frozenpoints`, `version`, `user_`) VALUES ('682571', '0.00', '0.00', '0', '687460') /*percona-toolkit src_db:renrendai_0513 src_tbl:point src_dsn:P=3306,h=192.168.1.40,p=...,u=checksums dst_db:renrendai_0513 dst_tbl:point dst_dsn:P=3306,h=192.168.1.41,p=...,u=checksums lock:1 transaction:1 changing_src:renrendai_0513.checksums replicate:renrendai_0513.checksums bidirectional:0 pid:7611 user:rrd199 host:mysqldbmaster*/;
REPLACE INTO `renrendai_0513`.`point`(`pointid`, `availablepoints`, `frozenpoints`, `version`, `user_`) VALUES ('682572', '0.00', '0.00', '0', '687461') /*percona-toolkit src_db:renrendai_0513 src_tbl:point src_dsn:P=3306,h=192.168.1.40,p=...,u=checksums dst_db:renrendai_0513 dst_tbl:point dst_dsn:P=3306,h=192.168.1.41,p=...,u=checksums lock:1 transaction:1 changing_src:renrendai_0513.checksums replicate:renrendai_0513.checksums bidirectional:0 pid:7611 user:rrd199 host:mysqldbmaster*/;
REPLACE INTO `renrendai_0513`.`point`(`pointid`, `availablepoints`, `frozenpoints`, `version`, `user_`) VALUES ('682573', '0.00', '0.00', '0', '687462') /*percona-toolkit src_db:renrendai_0513 src_tbl:point src_dsn:P=3306,h=192.168.1.40,p=...,u=checksums dst_db:renrendai_0513 dst_tbl:point dst_dsn:P=3306,h=192.168.1.41,p=...,u=checksums lock:1 transaction:1 changing_src:renrendai_0513.checksums replicate:renrendai_0513.checksums bidirectional:0 pid:7611 user:rrd199 host:mysqldbmaster*/;
REPLACE INTO `renrendai_0513`.`point`(`pointid`, `availablepoints`, `frozenpoints`, `version`, `user_`) VALUES ('682574', '0.00', '0.00', '0', '687463') /*percona-toolkit src_db:renrendai_0513 src_tbl:point src_dsn:P=3306,h=192.168.1.40,p=...,u=checksums dst_db:renrendai_0513 dst_tbl:point dst_dsn:P=3306,h=192.168.1.41,p=...,u=checksums lock:1 transaction:1 changing_src:renrendai_0513.checksums replicate:renrendai_0513.checksums bidirectional:0 pid:7611 user:rrd199 host:mysqldbmaster*/;
REPLACE INTO `renrendai_0513`.`point`(`pointid`, `availablepoints`, `frozenpoints`, `version`, `user_`) VALUES ('682575', '0.00', '0.00', '0', '687464') /*percona-toolkit src_db:renrendai_0513 src_tbl:point src_dsn:P=3306,h=192.168.1.40,p=...,u=checksums dst_db:renrendai_0513 dst_tbl:point dst_dsn:P=3306,h=192.168.1.41,p=...,u=checksums lock:1 transaction:1 changing_src:renrendai_0513.checksums replicate:renrendai_0513.checksums bidirectional:0 pid:7611 user:rrd199 host:mysqldbmaster*/;
REPLACE INTO `renrendai_0513`.`point`(`pointid`, `availablepoints`, `frozenpoints`, `version`, `user_`) VALUES ('682576', '0.00', '0.00', '0', '687465') /*percona-toolkit src_db:renrendai_0513 src_tbl:point src_dsn:P=3306,h=192.168.1.40,p=...,u=checksums dst_db:renrendai_0513 dst_tbl:point dst_dsn:P=3306,h=192.168.1.41,p=...,u=checksums lock:1 transaction:1 changing_src:renrendai_0513.checksums replicate:renrendai_0513.checksums bidirectional:0 pid:7611 user:rrd199 host:mysqldbmaster*/;
[rrd199@mysqldbmaster shells]$ pt-table-sync --execute --replicate renrendai_0513.checksums --sync-to-master --databases=renrendai_0513,--tables=poing, h=192.168.1.41,P=3306,u=checksums,p=checksums
执行完毕,检查数据;
[rrd199@mysqldbmaster shells]$ pt-table-sync --print --replicate renrendai_0513.checksums --sync-to-master --databases=renrendai_0513,--tables=point, h=192.168.1.41,P=3306,u=checksums,p=checksums
[rrd199@mysqldbmaster shells]$ pt-table-checksum u='checksums',p='checksums',P=3306 -d renrendai_0513 --tables=point --nocheck-replication-filters --create-replicate-table --replicate=renrendai_0513.checksums
Cannot connect to P=3306,h=192.168.1.13,p=...,u=checksums
Cannot connect to P=3306,h=192.168.1.12,p=...,u=checksums
Cannot connect to P=3306,h=192.168.1.14,p=...,u=checksums
TS ERRORS DIFFS ROWS CHUNKS SKIPPED TIME TABLE
04-21T16:15:35 0 0 706690 7 0 2.749 renrendai_0513.point