I have installed zookeeperd on Ubuntu 14.04 (Trusty Tahr) as suggested here:
Unfortunately this process is somehow not stoppable. I tried even kill -9
user@node1:/opt/zookeeper-3.4.6$ ps -ef | grep zookeeper
zookeep+ 4008 1 8 01:07 ? 00:00:00 /usr/bin/java -cp /etc/zookeeper/conf:/usr/share/java/jline.jar:/usr/share/java/log4j-1.2.jar:/usr/share/java/xercesImpl.jar:/usr/share/java/xmlParserAPIs.jar:/usr/share/java/netty.jar:/usr/share/java/slf4j-api.jar:/usr/share/java/slf4j-log4j12.jar:/usr/share/java/zookeeper.jar -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false -Dzookeeper.log.dir=/var/log/zookeeper -Dzookeeper.root.logger=INFO,ROLLINGFILE org.apache.zookeeper.server.quorum.QuorumPeerMain /etc/zookeeper/conf/zoo.cfg
show process
user 4055 2823 0 01:07 pts/3 00:00:00 grep --color=auto zookeeper
kill it
user@node1:/opt/zookeeper-3.4.6$ sudo kill -9 4008
Check:
user@node1:/opt/zookeeper-3.4.6$ ps -ef | grep zookeeper
zookeep+ 4075 1 24 01:07 ? 00:00:00 /usr/bin/java -cp /etc/zookeeper/conf:/usr/share/java/jline.jar:/usr/share/java/log4j-1.2.jar:/usr/share/java/xercesImpl.jar:/usr/share/java/xmlParserAPIs.jar:/usr/share/java/netty.jar:/usr/share/java/slf4j-api.jar:/usr/share/java/slf4j-log4j12.jar:/usr/share/java/zookeeper.jar -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false -Dzookeeper.log.dir=/var/log/zookeeper -Dzookeeper.root.logger=INFO,ROLLINGFILE org.apache.zookeeper.server.quorum.QuorumPeerMain /etc/zookeeper/conf/zoo.cfg
Try script
user@node1:/opt/zookeeper-3.4.6$ sudo /etc/init.d/zookeeper stop
user@node1:/opt/zookeeper-3.4.6$ ps -ef | grep zookeeper
zookeep+ 4075 1 29 01:07 ? 00:00:04 /usr/bin/java -cp /etc/zookeeper/conf:/usr/share/java/jline.jar:/usr/share/java/log4j-1.2.jar:/usr/share/java/xercesImpl.jar:/usr/share/java/xmlParserAPIs.jar:/usr/share/java/netty.jar:/usr/share/java/slf4j-api.jar:/usr/share/java/slf4j-log4j12.jar:/usr/share/java/zookeeper.jar -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false -Dzookeeper.log.dir=/var/log/zookeeper -Dzookeeper.root.logger=INFO,ROLLINGFILE org.apache.zookeeper.server.quorum.QuorumPeerMain /etc/zookeeper/conf/zoo.cfg
Nothing helps.
How could I stop ZooKeeper?
You could try:
sudo service zookeeper stop
to stop the process. If it does not work you could check this link:
If above commands do not stop the Zookeeper and the kill -9 is also not able to stop then there is perhaps a zombie process. You could check this Q&A how to stop such processes if that is the case.
From the zookeper root directory (
cd ~/zookeeper-3.4.6
) run the following commandbin/zookeeper-server-stop.sh
did not work on Mac. And a new process was getting spawned when trying to kill the process, even withSIGTERM
.Instead, stop ZooKeeper with Homebrew:
$ brew services stop zookeeper
Personally, I set an environment variable of $KAFKA_HOME - makes my life easier. If you do, you can create an alias for these sorts of things in the following manner:
And then you can just type
Or, if you installed into
/opt/kafka
for example, you could just type:I also like to create an alias to start zookeeper, here are two lines I added to the bottom of my
~/.bashrc
file: