MySQL: Continue a failed replication slave

Sometimes, a replication error (e.g. duplicate data due to binlog error) will cause the replication slave to fail and stop. The easiest solution is to skip the problematic binlog data. We can do it by:

mysql> SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; 
mysql> slave start;

By doing this, one line of replicated info is lost. So, do this only if the info to be skipped does not have real impact to the replicated database. My most recent use of this trick was when I encountered the following error:

[ERROR] Slave SQL: The incident LOST_EVENTS occured on the master. Message: mysqld startup, Error_code: 1590

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: