Tuesday, February 17, 2009

MySQL replication and slave errors

Sometimes, when there is connection problems, you run into situations, where data synchronization gets delayed and queries clash.

In such case, the mysql slave stops replicating until the issue is resolved.

Ideally, you would either reimport all your data from the master or resolve the issue manually. However sometimes that is not practical. In such a case, you have two easy ways to resume the replication process, ignoring the errors.

From mysql, you can issue these commands:

set global sql_slave_skip_counter = 1;
start slave;


Alternatively, you can ignore all errors in the future with this command line option:
--slave-skip-errors=1062,1053 (ignores duplicate primary key errors - you can specify other errors you want to ignore)

No comments: