You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@zookeeper.apache.org by prashantkumar dhotre <pr...@gmail.com> on 2019/12/13 07:18:56 UTC

'zkServer.sh status' connects only to local node ?

Hi,
Could you please help me with a basic query regarding 'zkServer.sh status' ?
From zkServer.sh, it appears that this cmd tries to connect to server at
local node and get info.
If the local server is down, does it connect to next available server (as
specified in config file )  and returns status ?
Or is this cmd intended to only report status of local server and not
status of zookeeper quorum ?
My use case is, my client app needs to connect to zookeeper and create
znode.
connect routine ( which does zookeeper_init2) has retries and in case of
connect failure, it sleeps and retries for number of times.
But if zookeeper quorum is down (zookeeper not running ) then I don't want
to even attempt connection ( hence avoid wait delay in connect api)
Regards,
Prashant

Re: 'zkServer.sh status' connects only to local node ?

Posted by "Chris T." <c....@gmail.com>.
Hi Prashant,

correct it only checks the local node. We built a script that parses the
dynamic config file and goes over all the nodes to report their status. You
can do this easily from shell  by enabling adminserver functionality and
issuing curl http://yourzookeepernode.com:8081/commands/stats  and grabbing
the server status from the output. Added bonus is that a call to 'stats' is
much faster than spinning up a jvm for each check (which zkServer.sh will
do) and will report a zookeeper that is running but attempting to connect
to it's peers (no quorum yet) as 'not currently serving connections'
whereas zkserver.sh status simply states it could not connect without
telling you the program is in fact running but not yet open for business.



Regards,

Chris

On Fri, Dec 13, 2019 at 8:19 AM prashantkumar dhotre <
prashantkumardhotre@gmail.com> wrote:

> Hi,
> Could you please help me with a basic query regarding 'zkServer.sh status'
> ?
> From zkServer.sh, it appears that this cmd tries to connect to server at
> local node and get info.
> If the local server is down, does it connect to next available server (as
> specified in config file )  and returns status ?
> Or is this cmd intended to only report status of local server and not
> status of zookeeper quorum ?
> My use case is, my client app needs to connect to zookeeper and create
> znode.
> connect routine ( which does zookeeper_init2) has retries and in case of
> connect failure, it sleeps and retries for number of times.
> But if zookeeper quorum is down (zookeeper not running ) then I don't want
> to even attempt connection ( hence avoid wait delay in connect api)
> Regards,
> Prashant
>