Mysql 多个离线数据库 [英] Mysql Multiple offline databases

查看:49
本文介绍了Mysql 多个离线数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在主服务器上运行的 Web 应用程序.

I have a web application that runs on an a main server.

同一个应用程序也运行在多个离线服务器上.这些离线服务器在技术上并非一直处于离线状态,但互联网连接不可靠.

The same application also runs on multiple offline servers. These offline servers are not technically offline all the times but the internet connection is unreliable.

每当任何离线服务器上的互联网可用时,我都希望将其数据与主服务器同步.数据同步将是两种方式,来自主服务器的更改将转到离线服务器,反之亦然.

Whenever internet becomes available at any of the offline servers, I would like to sync its data with the main server. The data syncing will be two way, changes from the main server will go to the offline server and vice versa.

我正在研究 MySQL 复制,如果它只有一台主服务器和一台离线服务器,它会无缝地工作,但由于可以有多个离线服务器,我在想最好的方法是什么.

I am looking at MySQL replication and it would work seamlessly if it was just one main server and one offline server, but since there can be multiple offline server, I am thinking what is the best way to proceed.

MySQL 版本:mysql Ver 14.14 Distrib 5.5.52, for Linux (x86_64) using readline 5.1

MySQL Version: mysql Ver 14.14 Distrib 5.5.52, for Linux (x86_64) using readline 5.1

推荐答案

MySQL 复制不是您想要的.

MySQL replication is not what you want here.

  1. 默认情况下,MySQL 副本是只读的.这是有充分理由的.

  1. MySQL replicas are read-only by default. This is for good reason.

MySQL 复制假定线性时间线".没有合并来自多个来源的更改的规定;即使您在从主服务器拆分时将副本设置为可写,之后它也无法继续从主服务器复制更改,因为它的数据会与主服务器发散,并且无法协调更改.

MySQL replication assumes a linear "timeline". There is no provision for merging changes from multiple sources; even if you set a replica as writable while it was split from the master, it would be unable to continue replicating changes from the master afterwards, as its data would have diverged from the master, and it has no way to reconcile changes.

您需要在应用程序中实施同步方案.请注意,这可能很复杂——您需要考虑拆分的双方"都对对象进行了更改的情况.

You will need to implement a synchronization scheme in your application. Note that this may be complicated -- you will need to consider cases where changes have been made to an object by both "sides" of a split.

这篇关于Mysql 多个离线数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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