I've posted this here as its more of a mysql questions than c#, I have written some software that runs a local instance of mysql when it first starts, now once mysql is up I would like to synchronize the data between the remote database table and the local database table that the software runs (it shouldn't sync any other databases / tables as there are a lot).

I have replication setup to synchronize the entire database to another server which works unless the server goes down then it never comes back up, so based on that I don't think replication will work as when the software is closed it also closes MySQL.

So what would be the best method of synchronizing the remote and local databases?


You might get MySQL master/slave replication to work by adjusting the timeouts and re-issuing the "STOP SLAVE" and "START SLAVE" commands. In the slave config file, you can set slave-net-timeout to the number of seconds after which it considers the connection severed, and set master-connect-retry to the number of seconds it should pause between trying to reconnect. Both are set to 86400 seconds, or 1 day. For example, you might try 30 seconds like this:

slave-net-timeout = 30
master-connect-retry = 30

An alternative is to try a solution like SymmetricDS database synchronization or Tungsten. I've used SymmetricDS in situations where the network is slow or even unavailable at times, and it recovers automatically. It can be run as a standalone replication server, or it can be embedded and controlled from an application.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.