March 12th, 2013, 01:55 AM
Promoting slave as master
I am bit new to mysql replication and need help regarding switching mysql master slave nodes.
We have a master slave setup as below:
servera --> Master
serverb --> Slave
We had some maintenance on servera and for which we want to make serverb as master and servera as slave.
This is what we have performed up to now:
1) Confirmed that slave is in sync with master.
2) Stopped mysql on servera (master)
3) On serverb(slave) recorded the log position:
4) On serverb (Slave) performed the following:
With this, we the serverb is now acting as master. However, I am not sure on how to add back servera as slave now.
Do the following steps look good:
On servera, run the follwoing command:
CHANGE MASTER TO MASTER_USER='replicator', MASTER_PASSWORD='password', MASTER_HOST='serverb', MASTER_LOG_FILE='mysql-bin.000043', MASTER_LOG_POS=290832543;
Will this ensure that the replication will start from where it left?
On the new master (serverb), when I run show master status, i see the following:
I am wondering how the old bin-log file and the position can be used here.
It will be really great if someone can advise here..
thanks in advance!!!