# Assumptions: # 1. There is a "Primary Pod" called "West Coast". # 2. There is a "Secondary Pod" called "East Coast". This Pod is your failover # Pod. # 3. Each step executed performs a "connection check" status on all the # MySQL servers. If any applications are connected to any of the servers, # the script will abort. # 4. There is a flat text file with the entries: # west_db0, west_db0_failover, east_db0, east_db0_failover # west_db1, west_db1_failover, east_db1, east_db1_failover # west_db2, west_db2_failover, east_db2, east_db2_failover # 5. No DNS entries change that Replication is concerned about. For the, # applications, there are DNS entries they use to point to the right set # of Masters (db0, db1, db2). # 6. Command line options: # -t target server list # -s source server list # -a all server # -d use default options, /usr/local/data/db_server_list.txt, # and passwords stored at /usr/local/data/. # -h help menu # -e event you choose. # -l log file to save history of commands to. # 7. There are "monitor", "admin", "maintanence", "release", "monitor_secure", # "application", "root", "stats" accounts in MySQL. The ones we use are # "application" and "maintanence". We only use "application" to test # replication and all other commands use "maintanence". # 8. Events are: # stop_replication, start_replication, change_master, # app_read, app_write, slave_status, delete_replication, check_replication. # 9. All events are stored in a logfile. Master and slave status are saved # to the logfile. All non-show commands are saved into the log files. #1. Stop all Applications. #2. Change permissions on "application" account in MySQL. ./mysql_failover_db.py -d -e app_read -t west_db# #3. Check replication status. ./mysql_failover_db.py -d -e slave_status -a #4. Stop and delete replication from primary to east coast. ./mysql_failover_db.py -d -e stop_replication -t east_db# ./mysql_failover_db.py -d -e delete_replication -t east_db# #5. Perform backups of primary database servers. #6. Replicate from the east coast to the primary. # Confirmation will be asked for change_master. ./mysql_failover_db.py -d -e change_master -t west_db# -s east_db# ./mysql_failover_db.py -d -e start_replication -t west_db# ./mysql_failover_db.py -d -e slave_status -t west_db# #7. Check replication status. ./mysql_failover_db.py -d -e slave_status -a #8. Change permissions on "application" account in MySQL. ./mysql_failover_db.py -d -e app_write -t east_db# #9. Test Replication using a noop table. ./mysql_failover_db.py -d -e check_replication -t west_db# -s east_db# #10. DNS entries for the applications should have been finished by now. #11. Start and test applications.