Last active
April 29, 2021 03:47
-
-
Save codersofthedark/cceaa52247e69e2ff965 to your computer and use it in GitHub Desktop.
MySQL Replication: 'Duplicate entry for PRIMARY key'
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
while [ 1 ]; do if ['mysql -uroot -ppassword -e"show slave status \G;" | grep "Duplicate entry" | wc -l' -eq 2 ] ; then mysql -uroot -ppassword -e"stop slave; set global sql_slave_skip_counter=1; start slave;"; fi; sleep 1; mysql -uroot -ppassword -e"show slave status\G"; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
First version of the script works fine. Second commit broke it.