MySQL Replication – Resync master after slave taking over

master-slave-replicationMySQLreplication

A few days ago, we've had to stop every machine for some maintenance. Two of these were a MySQL master-slave. After the restart, the master didn't get the service back online and, due to the critical nature of the database, the slave took over, basically functioning as a normal, non-replicated service.

There were no changes to any of the my.cnf configuration files. The slave received various UPDATE and INSERT commands, so what will happen if I simply start the master back again? Will it manage to sync back? If not, how should I proceed?

Best Answer

If the Master was already acting as a Slave, then you really had a Master-Master setup, and the replication from the old Slave (current Master) will flow to the old Master that had been down.

Otherwise, you are in deep weeds. You may as well promote the currently-acting-as-Master machine to be the Master. And then rebuild the other machine as a Slave. Or rather a Master in Master-Master setup so you don't hit this problem again.