Hi All,

I am bit new to mysql replication and need help regarding switching mysql master slave nodes.

Scenario:

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:
Master_Log_File: mysql-bin.000043
Read_Master_Log_Pos: 290832543


4) On serverb (Slave) performed the following:

RESET SLAVE;
RESET MASTER;
Restarted mysql;

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:

File: mysql-bin.000003
Position: 35738417

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!!!

Thanks,
Vin