当前位置:Gxlcms > 数据库问题 > percona-toolkit之pt-table-sync修复Mysql主从数据一致性

percona-toolkit之pt-table-sync修复Mysql主从数据一致性

时间:2021-07-01 10:21:17 帮助过:24人阅读

从库执行:

mysql> select * from checksums;

+---------+-----+-------+------------+-------------+----------------+----------------+----------+----------+------------+------------+---------------------+

| db      | tbl | chunk | chunk_time | chunk_index | lower_boundary | upper_boundary | this_crc | this_cnt | master_crc | master_cnt | ts                  |

+---------+-----+-------+------------+-------------+----------------+----------------+----------+----------+------------+------------+---------------------+

| gaoquan | t1  |     1 |   0.001375 | NULL        | NULL           | NULL           | afa2742d |        3 | 9cf2c2d4   |          4 | 2015-12-25 16:17:35 |

+---------+-----+-------+------------+-------------+----------------+----------------+----------+----------+------------+------------+---------------------+

1 row in set (0.00 sec)

主库执行:

./pt-table-sync --execute --replicate test.checksums --sync-to-master h=10.50.12.35,P=3336,u=checksums,p=checksums

修复完毕后再使用pt-table-checksums进行主从一致性检测

主库执行:

./pt-table-checksum --nocheck-replication-filters --replicate=test.checksums --host=10.50.12.33 --port 3336 --databases=gaoquan -uchecksums -pchecksums --no-check-binlog-format --recursion-method=dsn=h=10.50.12.33,D=test,t=dsns

从库执行:

mysql> select * from checksums;

+---------+-----+-------+------------+-------------+----------------+----------------+----------+----------+------------+------------+---------------------+

| db      | tbl | chunk | chunk_time | chunk_index | lower_boundary | upper_boundary | this_crc | this_cnt | master_crc | master_cnt | ts                  |

+---------+-----+-------+------------+-------------+----------------+----------------+----------+----------+------------+------------+---------------------+

| gaoquan | t1  |     1 |     0.0008 | NULL        | NULL           | NULL           | 9cf2c2d4 |        4 | 9cf2c2d4   |          4 | 2015-12-28 11:44:53 |

+---------+-----+-------+------------+-------------+----------------+----------------+----------+----------+------------+------------+---------------------+

1 row in set (0.00 sec)



percona-toolkit之pt-table-sync修复Mysql主从数据一致性

标签:pt-table-sync

人气教程排行