Percona-toolkit's Pt-table-sync repair MySQL master-slave data consistency

Source: Internet
Author: User
Tags dsn percona

Download and user Empowerment Reference previous article Percona-toolkit pt-table-checksums detection of MySQL master-slave data consistency

Use Pt-table-checksums to detect data consistency, and then use Pt-table-sync for master-slave consistency repair, noting that the repaired table must have a primary key or a unique index

Under Main vault bash execution:

./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

Execute from Library:

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)

Main Library Execution:

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

After repair, use pt-table-checksums for master-Slave conformance detection

Main Library Execution:

./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

Execute from Library:

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's Pt-table-sync repair MySQL master-slave data consistency

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.