我现在想要复制一台服务器并提高可用性。我的软件堆栈中的元素之一是 Zookeeper,所以在它上面进行集群配置似乎很自然。
但是,我的单台服务器上有数据,我找不到任何关于集群设置的指南。我尝试设置两个独立的实例,然后进行集群配置,但只保留了所选主服务器上的数据。
那么,如何在不丢失数据的情况下安全地从单个服务器设置转到集群设置?
我现在想要复制一台服务器并提高可用性。我的软件堆栈中的元素之一是 Zookeeper,所以在它上面进行集群配置似乎很自然。
但是,我的单台服务器上有数据,我找不到任何关于集群设置的指南。我尝试设置两个独立的实例,然后进行集群配置,但只保留了所选主服务器上的数据。
那么,如何在不丢失数据的情况下安全地从单个服务器设置转到集群设置?
If you go from 1 server straight to 3 servers, you may lose data, as the 2 new servers are sufficient to form a quorum, and elect one of themselves as a leader, ignoring the old server, and losing all data on that machine.
If you grow your cluster from 1 to 2, when the two servers start up, then a quorum can't form without the old server being involved, and data will not be lost. When the cluster finishes starting, all data will be synced to both servers.
Then you can grow your cluster from 2 to 3, and again a quorum can't form without at least 1 server that has a copy of the database, and again when the cluster finishes starting all data will be synced to all three servers.