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?
I use:
Depending on your installation a running Zookeeper would look like
or sth. with zookeeper in it's name.
status can be checked using command:
it should show output like this:
One other way would be to use 4 letter commands to validate if zookeeper service is healthy or not
More details on the documentation link below https://zookeeper.apache.org/doc/r3.1.2/zookeeperAdmin.html#sc_zkCommands
I did some test:
When it's running:
When it's stopped:
I'm not running on the same machine, but you get the idea.
Above will work in whichever modes Zookeeper is running (standalone or embedded).
Another way
If zookeeper is running in standalone mode, its a JVM process. so -
will display list of jvm processes; something like this for zookeeper with process ID
Zookeeper is just a Java process and when you start a Zookeeper instance it runs a
org.apache.zookeeper.server.quorum.QuorumPeerMain
class. So you can check for a running Zookeeper like this:or even like this:
upd:
regarding this:
will hostname be the hostname of my box??
- the answer is yes.