Mysql – Autosync master and slave when master goes offline

MySQLmysql-5

I have a master slave setup using MySQL 5.0.
I have very frequent writes to the master and slave is used only for backup purpose (no explicit writes).

In my current configuration, the slave database is synced with the master by MySQL automatically via VPN. But if the system (win 7) consisting of Master goes down for some reason, after reboot the synchronization doesn't continue from the last synced record. Instead I have to stop the services at both the ends, delete and recreate the config files, move the sql of the backup from master to slave and restart the sync. All this has to be done every time my system goes down for any reason.

Is it possible to avoid this so that whenever master system goes down, the syncing starts again as usual ?

Best Answer

If you have a normal shutdown, you should not have this problem.

Investigate if your MySQL service properly stops on shutdown and try to see what happens if you manually stop MySQL prior to shutdown.

Also check to see if sending data from master to slave over VPN results in data corruption. This can very easily happen in MySQL 5.0 since there are no checksums done for transferring binlogs to slave. I would advise to upgrade to MySQL 5.5 as it handles replication corruption better.