Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Application of pt-table-checksum tools

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. Read the error message carefully and open debugPTDEBUG=1 when you don't understand the situation.

2.10.10.10.10 is dominant, and other ip is subordinate

3. Hobbies 10.10.10.10 there must be no spaces in between, otherwise an error will be reported. It took me a long time to troubleshoot this error.

One: data detection and synchronization of film_actor table in sakila library

1, add users to the master library and slave library:

GRANT SELECT, PROCESS, SUPER, REPLICATION SLAVE ON *. * TO 'checksums'@'10.10.10.10' IDENTIFIED BY' checksums'

two。 Check whether the master-slave data of the film_actor table in sakila library is consistent.

PTDEBUG=1 pt-table-checksum-no-check-binlog-format-- no-check-replication-filters-- recursion-method=processlist-- replicate=test.checksums-- databases=sakila-- tables=film_actor-h 10.10.10.10-P8888-u checksums-p checksums

3. Recover all film_actor data from the slave database according to the results of checksum

PTDEBUG=1 pt-table-sync-- replicate=test.checksums-- recursion-method=processlist-- database=sakila-- tables=film_actor hackers 10.10.10.10

-

Second: check whether the tmp database data are consistent

Pt-table-checksum-- no-check-binlog-format-- no-check-replication-filters-- recursion-method=processlist-- replicate=test.checksums-- databases=tmp-h 10.10.10.10-P8888-u checksums-p checksums

1. Recover all data from the slave database according to the results of checksum

PTDEBUG=1 pt-table-sync-- replicate=test.checksums-- recursion-method=processlist-- no-check-triggers-- no-check-child-tables-- no-foreign-key-checks hackers 10.10.10.10

(if there is a foreign key constraint, add the parameter-- no-check-child-tables-- no-foreign-key-checks, otherwise all the data in the child table may be deleted.)

(--no-check-triggers, do not detect triggers)

2. Only 10.10.10.11 data is recovered according to the results of checksum.

Pt-table-sync-- print-- execute-- replicate=test.checksums-- sync-to-master hackers 10.10.10.11

3. Restore the data from the slave database 192.168.6.91 (all the data in this slave database is consistent with the master, except for the system table and checksums table)

Pt-table-sync-- execute-- print-- sync-to-master hackers 192.168.6.91

-

After executing pt-table-sync, you can execute pt-table-checksum again to check whether the master-slave data is consistent. You can execute the following sql statement. If the result is empty, the master-slave data is consistent.

Select * from test.checksums where master_cnt this_cnt OR master_crcthis_crc OR ISNULL (master_crc) ISNULL (this_crc)

Http://blog.itpub.net/28939273/viewspace-1993010/

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report