Migrating from a single zookeeper server to a clustered configuration

I have one server that I now want to replicate and upgrade to higher availability. One of the elements in my program stack is if Zookeeper, so it seems natural to switch to the cluster configuration on it.

However, I have data on my only server, and I could not find any guidance on moving to cluster configuration. I tried to configure two independent instances, and then switched to a cluster configuration, but only the data available on the selected host was saved.

So, how can I safely switch from installing a single server to a clustered installation without data loss?

+4
source share
1 answer

If you go from 1 server directly to 3 servers, you can lose data, since 2 new servers are enough to form a quorum and choose one of them as a leader, ignoring the old server and losing all the data on this machine.

If you increase your cluster from 1 to 2, when two servers start up, then the quorum will not be able to form without the participation of the old server, and the data will not be lost. When the cluster finishes launching, all data will be synchronized with both servers.

Then you can expand your cluster from 2 to 3, and again a quorum cannot be formed without at least 1 server with a copy of the database, and again, when the cluster finishes launching, all data will be synchronized with all three servers.

+2
source

All Articles