6

I need to weekly sync a large (3GB+ / 40+ tables) local MySQL database to a server database. The two databases are exactly the same. The local DB is constantly updated and every week or so the server DB need to be updated with the local data. You can call it 'mirrored DB' or 'master/master' but I'm not sure if this is correct.

Right now the DB only exist locally. So:

1) First I need to copy the DB from local to server. With PHPMyAdmin export/import is impossible because of the DB size and PHPMyAdmin limits. Exporting the DB to a gzipped file and uploading it through FTP probably will break in the middle of the transfer because of connection to the server problems or because of the server file size limit. Exporting each table separately will be a pain and the size of each table will also be very big. So, what is the better solution for this?

2) After the local DB us fully uploaded to the server I need to weekly update the server DB. What the better way to doing it?

I never worked with this kind of scenario, I don't know the different ways for achieving this and I'm not precisely strong with SQL so please explain yourself as good as possible.

Thank you very much.

2 Answers 2

3

This article should get you started.

Basically, get Maatkit and use the sync tools in there to perform a master-master-synchronization:

 mk-table-sync --synctomaster h=serverName,D=databaseName,t=tableName
2

You can use a DataComparer for mysql. Customize the template synchronization, which specify the data which tables to synchronize. Schedule a weekly update on the template. I have 2 servers daily synchronized with dbForge Data Comparer via command line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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