ZooKeeper - add peers dynamically?

I am new to ZooKeeper. This is what I need.

I have a peer network.

  • In t=t_1 -> [peer-1 (Leader), peer-2] peer-1 is the master, and all clients connect to this node.

  • Q t=t_2 -> [peer-1 (Leader), peer-2, peer-3] At some point in time, group-3 joins the group. Is it possible to add peer-3 to the list of zookeeper servers “dynamically” (i.e., without restarting ZooKeeper on the peer)?

  • B t=t_3 -> [peer-3 (Leader), peer-4] After some time, both groups are -1 and peer groups leave the group (for example, they die or turn off). Assuming that there is a way to dynamically add peer-3 and peer-4 to the peer-3 group, it becomes a leader and all client requests are sent to the peer.

Are there any other features that I can use other than using ZooKeeper to do something like this.

thank.

+5
source share
2 answers

Currently, you cannot dynamically change the configuration of a zookeeper cluster without restarting it. There is an open problem to fix this, ZOOKEEPER-107 . The document describing the cluster membership algorithm is very interesting and can be found.

You can change the cluster configuration by restarting server nodes 1 at a time. For example, if the cluster has servers A, B, C, and you want to replace server C with D, you can do something like

  • Reset C
  • Raise D, peer list - A, B, D
  • Remove B
  • Change convolution list B to A, B, D
  • Connect B
  • A A, B, D
  • A
  • , A, B, D

t = t_1 zookeeper. , node , ( (N/2) + 1), . zookeeper .

, , ,

peer-3 , peer-3.

, node zookeeper , , , . , , , , , , . leaderServes, , .

+6

. , ZK , .

: C D, - A, B, D "

- > A B D - > D A B

A B, B .

zk, , . , zk, readonly .

Zookeeper-107 Zookeeper 3.5, .

:

  • zk- (zk-)
  • zk- zk-
  • zk-
+1
source

All Articles