Created
April 15, 2011 15:18
-
-
Save jofi/921867 to your computer and use it in GitHub Desktop.
mysql-slave-recovery
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
# IST DO SCREENU, aby si pri tom nemusel nocovat!!! | |
# ideme odobrat najnovsi dump z MASTERA (je jedno na ktorom stroji sme - mozno je vyhodnejsie byt na slave-ovi): | |
# priprava na dump a vynulovanie binary logov | |
mysql -h db-master -u root -p | |
FLUSH TABLES WITH READ LOCK; | |
RESET MASTER; | |
PURGE BINARY LOGS; | |
UNLOCK TABLES; | |
SHOW MASTER STATUS \G; | |
EXIT; | |
# Urobenie samotneho dumpu: | |
mysqldump -h db-master -u root -p --lock-tables --master-data --all-databases > db-master-latest.sql | |
# TOTO UZ URCITE ROBIT NA SLAVEOVI!!! | |
mysql -u root -p | |
STOP SLAVE; | |
source db-master-latest.sql; | |
RESET MASTER; | |
START SLAVE; | |
SHOW SLAVE STATUS \G; | |
EXIT; | |
# NA MASTEROVI!!!! (teda na node, ktory drzi servis (v nasom pripade slaveIP) je ho treba uvolnit) | |
/usr/lib/heartbeat/hb_standby --help | |
sudo /usr/lib/heartbeat/hb_standby foreign #Uvolni zo mna vsetko coho preferovany node je ten druhy (foreign) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment