将大型本地数据库与服务器数据库(MySQL) [英] Sync large local DB with server DB (MySQL)

查看:180
本文介绍了将大型本地数据库与服务器数据库(MySQL)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要每周同步大型(3GB + / 40+表)本地MySQL数据库到服务器数据库。
两个数据库完全相同。本地DB不断更新,每周左右,服务器数据库需要用本地数据更新。您可以将其称为镜像DB或主/主,但我不确定这是否正确。

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)首先我需要将DB从本地复制到服务器。使用PHPMyAdmin导出/导入是不可能的,因为DB大小和PHPMyAdmin限制。将数据库导出到gzipped文件并通过FTP上传可能会在传输过程中中断,因为连接到服务器问题或由于服务器文件大小限制。单独导出每个表将是一个痛苦,每个表的大小也将非常大。那么,这个更好的解决方案是什么?

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)当本地数据库完全上传到服务器后,我需要每周更新服务器数据库。有什么更好的方法吗?

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.

非常感谢。

推荐答案

这篇文章应该让你开始。

基本上,获取 Maatkit ,并使用其中的同步工具执行主 - 主同步:

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

这篇关于将大型本地数据库与服务器数据库(MySQL)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆