Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if ZooKeeper is running or up from command prompt?

I exploring a few options to setup kafka and I knew that the Zookeeper has to be up and running to initiate a kafka.

I would like to know how can I find the below.

1) hostname and port for my zookeeper instance---I checked the zoo.cfg and I could only find the ClientPort not the hostname, will hostname be the hostname of my box??

2) To check if ZooKeeper is up and running---I tried to do a ps -ef | grep "zoo" I could not find anything. May be I am using a wrong key word to search??

Any help would be really appreciated?

like image 739
Suren Baskaran Avatar asked Mar 17 '15 18:03

Suren Baskaran


People also ask

How do I start ZooKeeper from command line?

In order to perform ZooKeeper CLI operations, at very first we have to turn on our ZooKeeper server (“bin/zkServer.sh start”). Afterward, we will also turn on ZooKeeper client (“bin/zkCli.sh”). Hence, we can perform the following operation, once the client starts: Create znodes.

How do you run a ZooKeeper?

Start the ZooKeeper server before starting Application Builder. To start the ZooKeeper server on a Linux system, use the Zookeeper/zookeeper/bin/zkServer.sh restart command from your Watson Explorer installation directory. On Microsoft Windows systems, use the Zookeeper\zookeeper\bin\zkServer. cmd command.


1 Answers

To check if Zookeeper is accessible. One method is to simply telnet to the proper port and execute the stats command.

root@host:~# telnet localhost 2181 Trying 127.0.0.1... Connected to myhost. Escape character is '^]'. stats Zookeeper version: 3.4.3-cdh4.0.1--1, built on 06/28/2012 23:59 GMT Clients:  Latency min/avg/max: 0/0/677 Received: 4684478 Sent: 4687034 Outstanding: 0 Zxid: 0xb00187dd0 Mode: leader Node count: 127182 Connection closed by foreign host. 
like image 65
Haoyuan Ge Avatar answered Oct 27 '22 07:10

Haoyuan Ge