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 host changed
If the master is changing, you need to reconfigure sshtunnel 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/commons.conf</tt>.
 * Run trainwreck manually: /opt/local/bin/trainwreck -af /etc/trainwreck/commons.conf -F -p </tt>
 * Stop it: /opt/local/bin/twctl -c /etc/trainwreck/commons.conf shutdown</tt>
 * Start it properly: svcadm enable trainwreck:instance</tt>