I'm running traditional master/slave replication on MySQL 5.1.52, my master is set for statement based replication. A few tables are missing rows on the slave (differing row counts), these tables are insert only on the master using "load data infile …", with auto-increment Pks. It is strange that the missing rows on the slave have gaps in the PK values where the rows should be. Slave is marked read-only so there are no accidental deletes.
Mysql – How to diagnose missing rows on a MySQL slave
MySQLreplication
Best Answer
The traditional way would be to use pt-table-checksum and pt-table-sync
I like doing things a little different. I immediately run
pt-table-sync
with the--sync-to-master --print
options.Here is the --sync-to-master option
Here is the --print option
This, if you do something like this:
The file
/root/SQLChanges.sql
will contain every change you need to execute on the Slave. Once you are satisfied with its contents, just execute the script on the Slave.With regard to using LOAD DATA INFILE in Replication, @DTest answered this question about that. I further explained how mysql replicates LOAD DATA INFILE.