mysql 脱机同步,在线/离线数据库同步-MySQL / PHP

I am developing a web application using php and mysql. This application runs on three different locations.

On internet

Head office

Branch office

Application runs on local server on head office and branch office. Internet connection is not available on every time. Customers placing orders through these three locations. My problem is, I want to synchronize the data among these three databases and keep these three databases up to date. Is there any way to do this?

解决方案

I'm using SymmetricDS to synchronize databases. It is capable of synchronizing or replicating data between nodes (servers/databases), only pushing or pulling the data you define. It is a software based on Java, it has a steep learning curve, but it really does the job.

SymmetricDS can be set up to push changes from one node to the two other nodes, thus making sure that all three nodes contains the same data. You need to make sure that primary keys are unique keys, and not auto incremented values assigned by the database as this most likely will be an issue across the three different databases you'd like to synchronize.

The software installs triggers on the database, and captures changes when INSERT, UPDATE or DELETE (and other) operations are carried out. These data changes are then invoked on the other nodes. The software needs to run on each location, but does not need an internet connection that is available at all times.

I did worry in the beginning that triggers on all my tables would slow down performance, but this has not been a problem at all. I can't say that we've discovered any issues with performance after the triggers were installed.

Have a look at http://symmetricds.org/ for more details.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值