Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Proposal

...

For Client-Side Changes To Support Dynamic Server Configuration

In the existing client implementation, a static server list is provided to the ZooKeeper constructor while creating a client object. If the server list contains host names, then the name to IP mapping is performed only once. The server list as well as the resolved IP addresses remains unchanged. With dynamic reconfiguration [1],[2] of ZooKeeper servers, ZooKeeper clients need a way to determine the most up-to-date server list.

...

  1. Add support for HTTP and file URL
  2. Add support to periodically retrieve the server list from the URL
  3. Allow application to set the server list
  4. Leave the responsibility of updating the URL to the application

B. Automatic

...

refresh of

...

server configuration

We will support Web server and a file as external resource. The reference to the external resource will be provided to the ZooKeeper constructor as string (see ZOOKEEPER-390).

...

The client will refresh from the URL every (n + r) seconds. In addition, the client will trigger a refresh (by waking up the refresh thread) if m successive connection attempts fail. The default value of m will be set to (s/3 + 1), where s is the size of the server list. The value can be set by “zookeeper.refreshAfterNumFailure” system property. If the application wishes to refresh every time the client disconnects from the server then this property can be assigned a value 0.

C. Letting the

...

client application specify the server configuration

For applications that want to use their own independent discovery and refresh mechanism, we will add a new method to ZooKeeper class.

...

Note that this allows the application to update the server list (in a best effort manner) by using watches. The application can set a watch on the configuration znode (/zookeeper/config) that records the last committed server configuration. Once the watch is triggered, the application can read the configuration and call resetServerList(serverConfig).

D. Future

...

extensions

  • A tool to update a password protected HTTP URL.
  • Avoid URL refresh from the same JVM for each client. This problem is similar to implementing shared sessions.
  • Support for DNS based discovery at the client?
  • For applications that want to use protocols other than file or URL, we could provide a callback mechanism. When the client library needs to retrieve the server list, it will invoke the callback method in the application. It will be responsibility of the application to discover the server list.
  • For applications do not have external web server or file server to record the configuration, we can implement the solution using virtual IPs described in ZOOKEEPER-1031.

...

Wiki Markup
<ac:structured-macro ac:name="anchor" ac:schema-version="1" ac:macro-id="b02a8c0c01c961fb-54643a05-444e408d-bd768c99-5b9b691e1040a6e1733d61e7"><ac:parameter ac:name="">107</ac:parameter></ac:structured-macro> \[1\]  JIRA for dynamic cluster membership. [https://issues.apache.org/jira/browse/ZOOKEEPER-107]

Wiki Markup
<ac:structured-macro ac:name="anchor" ac:schema-version="1" ac:macro-id="01c93fc6a6e01c0b-0262da88-4e1a4b15-9f9d9a6f-b07414a2f6fbf206295e4317"><ac:parameter ac:name="">107wiki</ac:parameter></ac:structured-macro> \[2\] Cluster Membership design. [https://cwiki.apache.org/confluence/display/ZOOKEEPER/ClusterMembership]