I have set up MySQL master-slave replication successfully. But I realized it doesn't work if I would like to simulate the real-world case. Here is my scenario:
- Make sure the data have been fully replicated to Salve from Master.
- Shutdown the Master node.
- Insert some new data(say test-data) into the table in Slave.
Now the master is back to normal. I would like to sync up the test-data back to Master node. Here are 2 methods I tried:
- Restart the Master node and reset the Slave node.
- Switch over the role of them, change original Slave to Master, original Master to Slave.
Looks like both 2 methods can only sync up the data which are inserted after I bring Master up. But both 2 methods miss test-data which was inserted into the table during Master down. So far I can only think about copying data by mysqldump before I sync two nodes again. Then the data will be consistent between 2 nodes. But it is not very effective. How do I sync up the test-data backup to master in a more effective way?
I am very new to MySQL, any help is appreciated!