How to re-sync the Mysql replication if Master down



  • I have a very simple webapp infra: FE => BE => MySQL. I have set up MySQL master-slave replication successfully. If my MySQL master node is down, I can manually point the MySQL IP to the Slave node in my BE. Users can insert data into the table with no problem. But I cannot re-sync the data backup to the master node after I bring the master node up. So far I tried 2 methods but both of them don't work:

    1. Restart the Master node and reset the Slave node.
    2. Switch over the role of them, change original Slave to Master, original Master to Slave.

    If the Master is down, how do I re-sync the data back to Master from Salve after Master is back to normal? In my case, do I have to copy the data from Slave to Master by mysqldump before re-sync?

    I am very new to MySQL, any help is appreciated!



  • What you needed to set up was "dual-Primary" (aka "dual master"). This is where each of the two servers was both Primary and Replica to the other. That way, you would already have set up the replication mechanisms so that failover and fallback would be the same process.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2