Replication Errors

suggest change

Whenever there is an error while running a query on the slave, MySQL stop replication automatically to identify the problem and fix it. This mainly because an event caused a duplicate key or a row was not found and it cannot be updated or deleted. You can skip such errors, even if this is not recommended

To skip just one query that is hanging the slave, use the following syntax

SET GLOBAL sql_slave_skip_counter = N;

This statement skips the next N events from the master. This statement is valid only when the slave threads are not running. Otherwise, it produces an error.

STOP SLAVE;
SET GLOBAL sql_slave_skip_counter=1;
START SLAVE;

In some cases this is fine. But if the statement is part of a multi-statement transaction, it becomes more complex, because skipping the error producing statement will cause the whole transaction to be skipped.

If you want to skip more queries which producing same error code and if you are sure that skipping those errors will not bring your slave inconsistent and you want to skip them all, you would add a line to skip that error code in your my.cnf.

For example you might want to skip all duplicate errors you might be getting

1062 | Error 'Duplicate entry 'xyz' for key 1' on query

Then add the following to your my.cnf

slave-skip-errors = 1062

You can skip also other type of errors or all error codes, but make sure that skipping those errors will not bring your slave inconsistent. The following are the syntax and examples

slave-skip-errors=[err_code1,err_code2,...|all]

slave-skip-errors=1062,1053
slave-skip-errors=all
slave-skip-errors=ddl_exist_errors

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents