Tuesday, May 30, 2017

Ensuring replication consistency


Ensuring replication consistency

pt-table-checksum http://www.percona.com/doc/percona-toolkit/2.1/pt-table- checksum.html

Checksum master from any node:
pt-table-checksum h=192.168.56.201

Verify no table diffs:
pt-table-checksum h=192.168.56.201 --replicate-check- only 


Create and fix a replication diff
Let’s create some discrepancy in replication.
Run UPDATE query on the slave:
mysql> UPDATE employees.dept_manager SET from_date=CURDATE() WHERE emp_no=110022;

Checksum master again, just this one table:
pt-table-checksum h=192.168.56.201 --tables employees.dept_manager

Fix it by running pt-table-sync on the master:
pt-table-sync --execute --replicate percona.checksums --sync-to- master 192.168.56.202

Re-checksum the table in question:
pt-table-checksum h=192.168.56.201 --tables employees.dept_manager 

No comments:

Post a Comment