I have 2 5.0 MySQL servers running in Master-Master replication and before refreshing the in-memory data representation I want to ensure that both databases have exactly the same content. To do so currently I am using the following logic
-
Ensure that
Slave_IO_Running&Slave_SQL_Runningare set to yes on both side -
On one side issue
show master status;to retrieve the current master file and position -
On the other side issue
show slave status;to retrieve the value ofMaster_Log_File&Exec_Master_Log_Pos -
Then I compare the values from the 2 sides and if the second side values are equal or higher I return that the replication has taken place.
I am aware that the field seconds behind master might be another way to check http://dev.mysql.com/doc/refman/5.5/en/show-slave-status.html but it says that on slow networks it might not be exact.
The main reason why I am asking is because I have been seeing cases where one the master’s position could be 35000 and on the slave it is only at 2000 and nothing is happening as if the catalogs from which the show slave status is based were not updated in a timely manner.
I am starting to design an alternative verification method involving checksums following the percona’s toolkit idea.
Any thoughts and suggestion warmly welcomed!
Cheers,
Instead of
Seconds_Behind_MasterI use pt-heartbeat from Percona Toolkit to monitor replication lag. You can use that tool to confirm that your secondary master is caught up to the primary master, but if you want to compare the actual data on the two masters I recommend pt-table-checksum.