We have MySQL master and replication servers both running on different machines. We have noticed some system files showing integrity issues in the master machine. Temporarily we would like to make the slave as a master and reformat the original master and then bring back everything to the original architecture.
What are the crucial steps now for us to maintain data integrity?
We can down the master and let the inserts and update take place in the replication db, but how do we revert back to the original situation later?
Best Answer
Globally speaking, I would essentially be performing the following steps in the same situation.
Before starting, backup everything on both machines.
SHOW FULL PROCESSLIST
; in MySQL.STOP SLAVE;
and turn off the master server.For step 2, when you are making sure that the master and slave are synced, you would do this. Comparing the current log file and file position for both servers.
On the master server
On the slave server
Since you are planning on reverting back to the original infrastructure, there is no need to setup the slave server as a new master. You can leave the slave server's configuration in place, so that once the master server is back online, you can restart replication more quickly.
Configuring replication
Rolando answered a similar question with an easy to read how to on setting up replication.
Clarification about master slave configuration in mysql