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:
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;
UPDATED LIST OF COMMANDS:
On Master: CHANGE MASTER TO MASTER_HOST=slave.com, MASTER_LOG_FILE=MASTER_LOG_FILE, MASTER_LOG_POS=MASTER_LOG_POS, .... START SLAVE; # Wait till caught up; STOP SLAVE; RESET MASTER; On Slave: CHANGE MASTER TO <original slave settings>; START SLAVE; USE mydb; FLUSH TABLES WITH READ LOCK; SET GLOBAL read_only=1;