SyntaxStudy
Sign Up
MySQL Replication Consistency and Drift
MySQL Advanced 4 min read

Replication Consistency and Drift

Consistency Drift

Replicas can silently drift from the primary over time due to errors or direct writes. Use pt-table-checksum and pt-table-sync to detect and fix drift.

Example
# Percona Toolkit: check consistency
pt-table-checksum --databases mydb h=primary,u=root,p=pass
# Output shows chunks that differ between primary and replica
# Fix inconsistencies
pt-table-sync --execute --replicate=percona.checksums h=primary
# Check for writes on replica (should be zero)
SHOW STATUS LIKE "Com_insert";
SHOW STATUS LIKE "Com_update";
SHOW STATUS LIKE "Com_delete";
Pro Tip

Set super_read_only=ON on replicas to prevent accidental direct writes that cause drift.