Toolserver:Admin:Change the replication master

Before you change the master, you need the new master position. It's usually in the server admin log, but if not, ask for it in #wikimedia-tech. If the master was changed by the WMF-guys because of a schema-change it is important to wait until the (then) old master was modified by the WMF-guys too.

If the master host changed
If the master is changing, you need to reconfigure SQL-Proxy to use the new master. Then choose one of the following options, based on the replication type.

For a MySQL-replicated cluster

 * Stop the MySQL slave: STOP SLAVE;
 * Change the MySQL master position: CHANGE MASTER TO master_log_pos=..., master_log_file='...';
 * Restart replication: START SLAVE;

For a trainwreck-replicated cluster

 * Stop the appropriate trainwreck instance: svcs trainwreck; svcadm disable trainwreck:instance
 * Wait for the reader and writer threads to exit (tail -f /var/svc/log/network-trainwreck:instance.log)
 * Delete the file 0.logpos, which will be in the statedir defined in /etc/trainwreck/instance.conf</tt>.
 * Run trainwreck manually: /opt/local/bin/trainwreck -af /etc/trainwreck/instance.conf -F -p </tt>
 * Stop it: /opt/local/bin/twctl -c /etc/trainwreck/instance.conf shutdown</tt>
 * Start it properly: svcadm enable trainwreck:instance</tt>