Best way to copy data to 2 zookeeper clusters?

I have some zookeeper clusters on startup, my goal is to combine the data in these zk clusters on one zookeeper cluster.

So copying all the data and the log from one zk cluster to another zk cluster is not suitable for me. Also, I may need to reinstall one full dir path, for example, I may need to copy the data for / service 1 in zk cluster1 to / c 1 / service1 on zk cluster 2

I am currently doing this work by writing zk client code to read the entire directory with data and ACL information in zk cluster 1 and write it to zk cluster 2.

However, some problems are approaching this:

  • It is difficult to determine which node is updated during the copy process.
  • A serial node can be a problem, I can write it as a regular non-segment node, and to further create a serial node in a new cluster, since a serial node number is created according to the parent information of node Cversion (the code looks like this, but it seems like if either the delete operation will be completed, the value will shift some), since I could not control the parent node Cversion (Can I?). If Cversion is less than the existing node sequence number (this can happen because we are copying data to a new cluster and ignore the history operation), further creation of a serial node can result in a node.exist error.

So, is there a better way to achieve my goal?

+3
source share
1 answer

You can use zkcopy to copy data between two zookeeper clusters.

+1
source

All Articles