问题原文
原帖链接 · Rakmo · CC BY-SA 4.0
For setting up Disaster Recovery topology using docker, is it possible to perform data replication from one server to another without using any orchestration layer (swarm/Kubernetes)? Any way to setup MySQL Master-Master or Master-Slave on 2 server setup?
What I do NOT want:
- Data replication using shared disk space
- No third party tool/software
- No Swarm or Kubernetes
I understand that for a proper Disaster Recovery system, the standby system is recommended to be in a totally different region, and it's acceptable that there is delay in data replication. What I want to know is will the both docker containers be able to communicate with each other properly? Is there anything that needs to be configured? Or will they just communicate normally as it would have been without docker?
已采纳解答
原帖链接 · Rick James · CC BY-SA 4.0
Two db servers, physically close to each other, will achieve the goal.
- There will still be some lag from the Primary to the Replica, but probably less than 1ms.
- The Replica won't start performing a replicated query until it has COMMITted on the Primary. (This is another mandatory lag.) As long as your writes affect only a small number of rows, this is also sub-millisecond or low-milliseconds.
- If Master-Master, each is allowed to receive writes, and each is both a "master" and a "slave". However, I recommend only writing to one at a time; the other is simply a hot standby.
- M-M is M-S already set up in both directions, hence allows for simplified failover.
- Whether each db server is actually inside a Docker container should not matter.
- But having two separate machines provides DR, whereas two Dockers in a single server does not protect against motherboard, disk, etc, failures.
- The pieces for failover is part of the standard issue MySQL/MariaDB, but the performing a failover is still manual.
- If one of the two machines fails, you need to take some non-trivial effort (and time) to rebuild the other machine.
- Two machines in the same flood plain, earthquake fault, tornado alley, etc. -- For real DR, you need geographic separation. But that leads to latency between servers. Can't have everything!
See also Galera Cluster (shipped with MariaDB; or can be added to MySQL). With it, 3 "nodes", one per server, gives automatic failover and automatic repair.
As far as I know, Docker does not introduce any extra impediments. Maybe someone else will chime in. If there are multiple MySQL instances in multiple dockers, then there is an issue of getting the Port numbers separate.
PS. dba.stackoverflow.com is a better sight for MySQL/MariaDB questions.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
