Last active
December 18, 2015 15:14
-
-
Save stollcri/ea6c93c8a69cedad0f21 to your computer and use it in GitHub Desktop.
Forward a MySQL slave past problematic SQL commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# It may become necessary to tell a MySQL replication slave to skip commands it | |
# is supposed to replicate. For eaxmple, if a table is deleted from the slave | |
# server and then it is deleted from the master server, the replication process | |
# will direct the slave to delete the table; since the table does not exist, | |
# the command cannot procees, and the replication gets stuck. The replication | |
# status on the slave cna be checked using 'SHOW SLAVE STATUS'. The slave drives | |
# replication, so the only way to check the stat us on the master is by using | |
# 'SHOW PROCESSLIST' | |
# see also: | |
# https://dev.mysql.com/doc/refman/5.7/en/replication-administration-status.html | |
# The first step is to verify that this is the cause. | |
tail -f /var/log/mysql/error.log | |
# Check if there is an error due to an un-runable command | |
# Then, open a connection to the slave server and run the following command | |
# to skip past the bad command. Watch the error log output | |
STOP SLAVE; SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; START SLAVE; | |
# Repeat as necessary |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment