[ https://issues.apache.org/jira/browse/ZOOKEEPER-107?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13102421#comment-13102421 ]
Alexander Shraer commented on ZOOKEEPER-107: -------------------------------------------- in the patch, configuration file was split to 2 parts - attached are sample files zoo_replicated1.members and zoo_replicated1.cfg. the cfg file points to the members file, and the members file has all information about membership and ports. You must specify all client ports in that file - this info is separated by ";" from the usual server info (client ports were made part of the configuration info so that when clients find out about new configurations they know how to connect to the servers). The cfg file can still include client ports (or hostname and port, but if given they must be the same as in the members file. There are 2 new commands - "config" that gets the new configuration and "reconfig" that changes the configuration. config has just one option "-c" which returns just the version of the configuration and connection string interesting to clients. reconfig has many options and you can change all ports and server roles in the members file. For example in the ZK shell: > reconfig -remove 1 -add 5=localhost:1234:1235:observer;1236 > reconfig -file new.members > reconfig -remove 3 -from 123456 (reconfigure only if the current config is > 123456) By doing "-add " and giving different ports/role to a server that is already in the cluster, you'll change its ports/role. Clients can subscribe to membership changes (membership is stored in a special znode, ZooDefs.CONFIG_NODE), and update the Zookeeper handle by executing "zk.updateServerList(hostList);" See src/java/systest/ReconfigClient.java or GenerateLoad.java for an example. I intend to update the algorithm to get better load balancing when new servers are added to the system (current method spreads load well only when a servers are removed). Alex > Allow dynamic changes to server cluster membership > -------------------------------------------------- > > Key: ZOOKEEPER-107 > URL: https://issues.apache.org/jira/browse/ZOOKEEPER-107 > Project: ZooKeeper > Issue Type: Improvement > Components: server > Reporter: Patrick Hunt > Assignee: Henry Robinson > Attachments: SimpleAddition.rtf, zoo_replicated1.cfg, > zoo_replicated1.members, zookeeper-3.4.0.jar, zookeeper-reconfig-sep11.patch > > > Currently cluster membership is statically defined, adding/removing hosts > to/from the server cluster dynamically needs to be supported. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira