4
votes

I have some zookeeper clusters on running, my goal is to combine data on these zk clusters onto one single zookeeper cluster.

So copy the whole data and log dir of one zk cluster to another zk cluster is not a possible approaching for me. And also, I might need to rebase one entire dir's path, for example, I might need to copy data for /service1 on zk cluster1 onto /c1/service1 on zk cluster 2

currently, I am doing this work by write some zk client code to read the entire dir tree with data and ACL info on zk cluster 1 and write it to zk cluster 2.

However, there are some issues remain with this approaching:

  1. Hard to determine which node is updated during the copy process.
  2. sequential node might be a problem, I can only write it as a normal non-sequential node, while for further creation of sequential node on the new cluster, since sequential node's sequence number is created according to parent node's Cversion info ( the code looks like this, but seems if some delete operation is done, the value will shift some ) , since I could not control the parent node's Cversion ( Can I ? ). If the Cversion is less than existing sequential node's sequence number ( this could happen since we do copy data onto new cluster and ignore the history operation ) the further creating of sequential node might lead to node.exist error.

So is there any better way to achieve my goal?

1

1 Answers

2
votes

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