This document details how to switch the MySQL replication master to a new machine. It makes the following assumptions:
1. There are two MySQL machines in a replication configuration
2. There is one master and one slave
3. Both are configured to be master-capable
4. The master has failed and there is a need to make the slave the master
STEPS TO PROCEED:
1. Stop Tomcat
/etc/init.d/tomcat stop
2. Stop Shibboleth
/etc/init.d/shibd stop
3. Shut down the master database by executing the following on the master machine:
/etc/init.d/mysql stop
4. On the slave server, log into MySQL:
/usr/local/mysql/bin/mysql -u root -p
5. On the slave server, stop the slave processing:
mysql> stop slave;
6. Stop the slave server:
/etc/init.d/mysql stop
7. On the slave server, add the following option to the /etc/my.cnf file:
skip_slave_start
— Please note that now your old slave server will be the new master —
--- All references to "Master" now refer to the former slave, now master —
--- All references to "Slave" now refer to the newly-configured slave —
--- The newly-configured slave will usually be the old master —
8. Start the master server:
/etc/init.d/mysql start
9. In the /usr/local/tomcat/conf/server.xml file on the new master, edit the "url=" line for the CAMS section, and make sure the address for the MySQL connection is correct.
10. In the /usr/local/tomcat/conf/context.xml file on the new master, edit the "url=" line in the Resource section, and make sure the address for the MySQL connection is correct.
11. In the /usr/local/shibboleth-idp/etc/resolver.jdbc.xml file on the new master, edit the "dbURL" line in the "JDBCDataConnector" section, and make sure the address for the MySQL connection is correct.
12. Set up a slave server using the Touchstone MySQL Replication instructions.
13. Ensure that the /usr/local/tomcat/conf/server.xml, /usr/local/tomcat/conf/context.xml, and /usr/local/shibboleth-idp/etc/resolver.jdbc.xml files on the new slave server have the correct database URLs, as above.
14. Start the Tomcat server
/etc/init.d/tomcat start
15. Stop the Tomcat server
/etc/init.d/shibd start