正如在ZooKeeper的文档中所说,有必要使用daemontools等工具来监督它。但是文档没有提供任何示例,我知道启动ZooKeeper的唯一方法是运行bin / zkServer.sh start。我打算用supervisord来完成这项工作,但是如何编写[program:zookeeper]部分已经超出了我的范围。任何例子都会很棒。感谢。
到目前为止,有两种解决方案:
[program:zookeeper] command = /usr/lib/jvm/java-1.7.0-openjdk.x86_64/bin/java -Dzookeeper.log.dir="." -Dzookeeper.root.logger="INFO,CONSOLE" -cp "/home/jizhang/Applications/zookeeper/bin/../build/classes:/home/jizhang/Applications/zookeeper/bin/../build/lib/*.jar:/home/jizhang/Applications/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/home/jizhang/Applications/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/home/jizhang/Applications/zookeeper/bin/../lib/netty-3.2.2.Final.jar:/home/jizhang/Applications/zookeeper/bin/../lib/log4j-1.2.15.jar:/home/jizhang/Applications/zookeeper/bin/../lib/jline-0.9.94.jar:/home/jizhang/Applications/zookeeper/bin/../zookeeper-3.4.3.jar:/home/jizhang/Applications/zookeeper/bin/../src/java/lib/*.jar:/home/jizhang/Applications/zookeeper/bin/../conf:" -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false org.apache.zookeeper.server.quorum.QuorumPeerMain "/home/jizhang/Applications/zookeeper/bin/../conf/zoo.cfg" stdout_logfile = /home/jizhang/Applications/zookeeper/zookeeper.out stderr_logfile = /home/jizhang/Applications/zookeeper/zookeeper.err autorestart = true
答案 0 :(得分:10)
有一个类似的问题here
[program:zookeeper]
command=zkServer.sh start-foreground
autorestart=true
stopsignal=KILL
那个问题提到了一个杀死这个过程的问题,我不确定是否有解决方案。