You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@zookeeper.apache.org by Debraj Manna <su...@gmail.com> on 2020/10/28 16:07:55 UTC

Correct way to check if zookeeper is running

Hi

Can someone let me know what is the recommended way to check if zookeeper
is running via netcat?

The documentation
<https://zookeeper.apache.org/doc/r3.5.2-alpha/zookeeperAdmin.html> states echo
"isro" | nc localhost 2181 .

But in few places it is recommended to use -q with netcat

https://stackoverflow.com/a/28424409/785523

Can someone let me know if -q is needed ?


   - Zookeeper Version 3.4.13
   - OS - Ubuntu 18

Re: Correct way to check if zookeeper is running

Posted by Zhewei <zh...@gmail.com>.
I think netcat has a bug that will be hanging sometime. You could use the -q
or -w option.





--
Sent from: http://zookeeper-user.578899.n2.nabble.com/

Re: Correct way to check if zookeeper is running

Posted by ashish soni <ai...@gmail.com>.
yes, Patrick is right. If you type nc you will see the available supported
flags. For example,
Usage: nc [OPTIONS] HOST PORT - connect
nc [OPTIONS] -l -p PORT [HOST] [PORT] - listen

-e PROG Run PROG after connect (must be last)
-l Listen mode, for inbound connects
-lk With -e, provides persistent server
-p PORT Local port
-s ADDR Local address
-w SEC Timeout for connects and final net reads
-i SEC Delay interval for lines sent
-n Don’t do DNS resolution
-u UDP mode
-v Verbose
-o FILE Hex dump traffic
-z Zero-I/O mode (scanning)

-q was used to wait for x seconds for a response to come back from the
server. This usually helps to give some secs for the server to respond and
reduce false positives if any.

On the same note, I would suggest using *zkServer.sh status *command and
grep the mode to see in which mode an instance is running. In the cluster,
the zookeeper runs in either leader or a follower. So this enhances the
healthcheck and guarantees that the zookeeper cluster is running as well as
it is in a quorum (which I believe is a good thing :) )


On Thu, Oct 29, 2020 at 9:25 AM Patrick Hunt <ph...@apache.org> wrote:

> I believe it depends which version of netcat you're using, see the
> following for background:
> https://issues.apache.org/jira/browse/ZOOKEEPER-737
>
> Regards,
>
> Patrick
>
> On Thu, Oct 29, 2020 at 6:18 AM Debraj Manna <su...@gmail.com>
> wrote:
>
> > Anyone any thoughts on this one? Same has been asked in stackoverflow
> also
> >
> >
> >
> https://stackoverflow.com/questions/64587307/correct-way-to-check-zookeepers-running-mode
> >
> > On Wed, Oct 28, 2020 at 9:37 PM Debraj Manna <su...@gmail.com>
> > wrote:
> >
> > > Hi
> > >
> > > Can someone let me know what is the recommended way to check if
> zookeeper
> > > is running via netcat?
> > >
> > > The documentation
> > > <https://zookeeper.apache.org/doc/r3.5.2-alpha/zookeeperAdmin.html>
> > > states echo "isro" | nc localhost 2181 .
> > >
> > > But in few places it is recommended to use -q with netcat
> > >
> > > https://stackoverflow.com/a/28424409/785523
> > >
> > > Can someone let me know if -q is needed ?
> > >
> > >
> > >    - Zookeeper Version 3.4.13
> > >    - OS - Ubuntu 18
> > >
> > >
> >
>

Re: Correct way to check if zookeeper is running

Posted by Patrick Hunt <ph...@apache.org>.
I believe it depends which version of netcat you're using, see the
following for background:
https://issues.apache.org/jira/browse/ZOOKEEPER-737

Regards,

Patrick

On Thu, Oct 29, 2020 at 6:18 AM Debraj Manna <su...@gmail.com>
wrote:

> Anyone any thoughts on this one? Same has been asked in stackoverflow also
>
>
> https://stackoverflow.com/questions/64587307/correct-way-to-check-zookeepers-running-mode
>
> On Wed, Oct 28, 2020 at 9:37 PM Debraj Manna <su...@gmail.com>
> wrote:
>
> > Hi
> >
> > Can someone let me know what is the recommended way to check if zookeeper
> > is running via netcat?
> >
> > The documentation
> > <https://zookeeper.apache.org/doc/r3.5.2-alpha/zookeeperAdmin.html>
> > states echo "isro" | nc localhost 2181 .
> >
> > But in few places it is recommended to use -q with netcat
> >
> > https://stackoverflow.com/a/28424409/785523
> >
> > Can someone let me know if -q is needed ?
> >
> >
> >    - Zookeeper Version 3.4.13
> >    - OS - Ubuntu 18
> >
> >
>

Re: Correct way to check if zookeeper is running

Posted by Debraj Manna <su...@gmail.com>.
Anyone any thoughts on this one? Same has been asked in stackoverflow also

https://stackoverflow.com/questions/64587307/correct-way-to-check-zookeepers-running-mode

On Wed, Oct 28, 2020 at 9:37 PM Debraj Manna <su...@gmail.com>
wrote:

> Hi
>
> Can someone let me know what is the recommended way to check if zookeeper
> is running via netcat?
>
> The documentation
> <https://zookeeper.apache.org/doc/r3.5.2-alpha/zookeeperAdmin.html>
> states echo "isro" | nc localhost 2181 .
>
> But in few places it is recommended to use -q with netcat
>
> https://stackoverflow.com/a/28424409/785523
>
> Can someone let me know if -q is needed ?
>
>
>    - Zookeeper Version 3.4.13
>    - OS - Ubuntu 18
>
>