You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Alexander Shraer (JIRA)" <ji...@apache.org> on 2015/06/30 16:54:04 UTC

[jira] [Commented] (ZOOKEEPER-2225) modify existing 'configuration' command or add new one to return list of ZooKeeper's ensemble members

    [ https://issues.apache.org/jira/browse/ZOOKEEPER-2225?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14608410#comment-14608410 ] 

Alexander Shraer commented on ZOOKEEPER-2225:
---------------------------------------------

Hi Grisha,

Actually, both things are already there! There is a command called getConfig that returns the config information (its similar to a read, so if you'd like the latest one do a sync beforehand) and reconfig returns the latest config too. 

take a look at what the CLI does for example (cli/ReconfigCommand.java)

            byte[] curConfig = zk.reconfig(joining, leaving, members, version, stat);
            out.println("Committed new configuration:\n" + new String(curConfig));

Here's what cli/GetConfigCommand.java does:
 
        byte data[] = zk.getConfig(watch, stat);
        data = (data == null) ? "null".getBytes() : data;
        if (cl.hasOption("c")) {
            out.println(ConfigUtils.getClientConfigStr(new String(data)));
        } else {
            out.println(new String(data));
        }

notice the ConfigUtils.getClientConfigStr used above - it takes the data returned by reconfig or getConfig
as input and returns a connection string you can pass to a ZooKeeper object or use to reconfigure client connections
to use the new set of servers using the updateServerString command. Take a look on a skeleton code here:

http://zookeeper.apache.org/doc/trunk/zookeeperReconfig.html#ch_reconfig_rebalancing


Cheers,
Alex





> modify existing 'configuration' command or add new one to return list of ZooKeeper's ensemble members
> -----------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-2225
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2225
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: server
>         Environment: Linux, AWS cloud
>            Reporter: Grigoriy Starchenko
>
> Hi, All
>  We are building high-availability ZooKeeper cluster at AWS and using version 3.5.0 because it support dynamic re-configuration. Everything works but one problem: it is difficult for ZooKeeper clients to discover current ensemble list. Obvious solution is to put ZooKeeper behind AWS load balancer. Client during initialization will call ZooKeeper via load balancer to read /zookeeper/config and will be able to build connection string. We quickly discovered ZooKeeper API not working trough AWS load-balancer.
>  ZooKeeper, starting from 3.5.0, support AdminServer option which working just fine behind any type of load balancers. The catch is: no command avail to date to get list of hosts representing ensemble. 
> http://localhost:8080/commands/...
> provide a lot of info but none of them returns
> {code}
> server.4108=10.50.4.108:2888:3888:participant;0.0.0.0:2181
> server.316=10.50.3.16:2888:3888:participant;0.0.0.0:2181
> server.1215=10.50.1.215:2888:3888:participant;0.0.0.0:2181
> version=100000000
> {code}
>  I think it would be very useful add new command:
> http://localhost:8080/commands/dconfig
>  which will return current ZooKeeper dynamic comfiguration:
> {code}
> {
>   "server.4108"  :  "10.50.4.108:2888:3888:participant;0.0.0.0:2181",
>    "server.316" : "10.50.3.16:2888:3888:participant;0.0.0.0:2181",
>    "server.1215" : "10.50.1.215:2888:3888:participant;0.0.0.0:2181"
>    "version" : "100000000"
> }
> {code}
> Thank you,
> Grisha
>  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)