简体   繁体   English

MySQL多主复制拓扑

[英]MySQL multi-Master replication topology

Disclaimer: I've never worked with replication before, but I'm doing all my research. 免责声明:我以前从未使用过复制,但是我正在做所有的研究。 Not really having a bunch of in-depth knowledge about MySQL makes a lot of the documentation hard to understand. 并不是真正拥有有关MySQL的深入知识,这使得很多文档难以理解。

We have a remote server, and many 'onsite' servers. 我们有一个远程服务器和许多“现场”服务器。 This app is mission-critical, and because of the unreliable internet connections on site, the onsite machines have fully functional instances of the application. 该应用程序是关键任务,并且由于站点上不可靠的Internet连接,因此站点计算机具有该应用程序的全功能实例。 Onsite machines are behind various firewalls and generally are not able to access each other. 现场计算机位于各种防火墙之后,通常无法相互访问。 We can set up SSH tunnels to allow the cloud DB to communicate with the onsite DBs. 我们可以设置SSH隧道,以允许云数据库与现场数据库进行通信。

Here's a simple diagram: 这是一个简单的图:

在此处输入图片说明

Async Multi-Master replication seems to be the best bet for us, but most of the documentation seems to imply that multi-source replication only works for slaves and/or multi-master replication only works circularly and a single master (in this case, the cloud server) can not replicate directly to multiple other masters. 异步多主复制似乎是我们的最佳选择,但是大多数文档似乎都暗示多源复制仅适用于从属,和/或多主复制仅适用于循环且单个主复制(在这种情况下,云服务器)不能直接复制到多个其他主服务器。

Am I interpreting this incorrectly (merely unable to find documentation on how to do this), or is this the case? 我是错误地解释了这一点(只是找不到有关如何执行此操作的文档),还是这种情况? If it's the case, are there are 3rd party packages like Tungsten or Galera we can use? 如果是这样,我们可以使用诸如钨或Galera之类的第三方包装吗?

After much research, I've found the answers. 经过大量研究,我找到了答案。 This is what's called a multi-master star topology, and it requires the hub (central) server to have several (>1) masters. 这就是所谓的多主星型拓扑,它要求中心(中央)服务器具有多个(> 1)个主星。 MySQL <5.7 does NOT support this, however, MySQL 5.7 (currently in dev) has introduced the concept of channels. MySQL <5.7不支持此功能,但是MySQL 5.7(当前在dev中)引入了通道的概念。 When you set CHANGE MASTER you can specify for which channel, allowing you to have multiple masters. 设置CHANGE MASTER时,您可以指定哪个频道,从而允许您拥有多个主控。

We did not want to use the dev version of MySQL, so we ended up using MariaDB which currently supports this in its general release (>10), albeit with a slightly different syntax. 我们不想使用MySQL的开发版本,因此最终使用了MariaDB,该语言目前在其常规发行版(> 10)中支持此功能,尽管语法略有不同。 It works wonderfully. 效果很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM