Mysql – Synchronizing two MySQL Server both serving clients after reconnect

data synchronizationMySQL

I am not a pro in DB…here is my case.

I have 2 MySQL databases on ServerA and ServerB and clients in 2 buildings, with only network connection between them and no more outer network available.

I am requested to sync the data and use each of them as backup:

  • When ServerA dies, clients in A will go to ServerB
  • When ServerA is up, it will sync back the data from ServerB.

The problem is when the connection between ServerA and ServerB is down, ServerA and ServerB should continue serving clientsA and clientsB making data not sync.

What should I do to sync them?

Best Answer

If you set them up with dual-master replication, they will be continually in sync. But don't write to both at the same time.