I have replication running between two MySQL instances on two separate servers. Let's say M is the master and S is the slave. It's setup as one way replication M->S. I currently have S as read only and writing binary logs with the --log-bin option. Suppose I have to failover to S because M goes down. What are the steps to recover M such that it is in sync with S again? And so S can become the SLAVE again?
I have seen the following thread but they depend on circular replication:
http://serverfault.com/questions/350756/recover-a-crashed-mysql-master-server-from-the-slave
http://serverfault.com/questions/350756/recover-a-crashed-mysql-master-server-from-the-slave
Steps I have so far to promote S to master:
STOP SLAVE IO_THREAD;
SHOW PROCESSLIST; check 'has read all relay log' status
STOP SLAVE;
SET GLOBAL read_only=0;
UNLOCK TABLES;
RESET MASTER;