Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I know my slave is at least a little out of sync from the master... and reading I found that many places say that mk-table-checksum + mk-table-sync from maatkit are the tool I should use to fix this.

The issue is that I can't find any good example about it:

this is my schema:

Host1 -> master
      |_ table1


Host2 -> slave
      |_ table1

my questions are:

  • Where should I run the command: master or slave?
  • (And of course) how... any syntax example?
share|improve this question
add comment

2 Answers 2

It's been a while since I had to do this, but if I remember correctly, you use mk-table-checksum against the master, and use the --replicate option. This writes checksum data for both master and slave tables. Then you run mk-table-sync --sync-to-master from the slave, which will get your slave rows consistent by updating rows in the master such that they replicate through to the slave.

As I say, my memory of this might be shaky, so read the docs for the tools to make sure you understand what they're doing, and test this in your test environment.

If your dataset isn't huge, you might be best to shut down for long enough to take a copy of the mysql data directory on the master and recreate the slave as this is the safest way to ensure you definitely get a consistent replica. If you're able to use LVM snapshots then even better - but this won't be possible unless you've configured your filesystems with this in mind.

share|improve this answer
add comment

Jon Topper's answer is correct. I would add that on the replica, you should also add the --replicate option to mk-table-sync so that it takes advantage of the work mk-table-checksum has already done.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.