下面是我的supervisord.conf文件。人们会认为它会启动动物园管理员,但事实并非如此。
如果我运行sh /var/chef/cache/zookeeper-3.4.5/bin/zkServer.sh start-foreground
,ZK会手动工作# -*- conf -*-
[include]
files = *.supervisor
[supervisord]
pidfile = /var/run/supervisord.pid
nodaemon=false
[supervisorctl]
serverurl=unix:///var/run/supervisord.sock ; use a unix:// URL for a unix socket
[unix_http_server]
file = /var/run/supervisord.sock
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[program:zookeeper]
command= sh /var/chef/cache/zookeeper-3.4.5/bin/zkServer.sh start-foreground
process_name=%(program_name)s
autostart=true
autorestart=true
stdout_logfile=/var/log/zookeeper.log
stopsignal=KILL
#stopasgroup = true
#killasgroup = true
#stdout_logfile = /tmp/zookeeper.out
#stderr_logfile = /tmp/zookeeper.err
pidfile = /var/run/zookeeper.pid
[group:zookeeper_server]
programs=zookeeper
答案 0 :(得分:0)
使用explicit命令而不在命令中调用shell,例如:
command=/opt/java/bin/java -Dzookeeper.log.dir="." -cp "/home/app/zookeeper/bin/../build/classes:/home/app/zookeeper/bin/../build/lib/*.jar:/home/app/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/home/app/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/home/app/zookeeper/bin/../lib/netty-3.2.2.Final.jar:/home/app/zookeeper/bin/../lib/log4j-1.2.15.jar:/home/app/zookeeper/bin/../lib/jline-0.9.94.jar:/home/app/zookeeper/bin/../zookeeper-3.4.5.jar:/home/app/zookeeper/bin/../src/java/lib/*.jar:/home/app/zookeeper/bin/../conf:" -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false org.apache.zookeeper.server.quorum.QuorumPeerMain "/home/app/zookeeper/bin/../conf/zoo.cfg"
使用/ opt / java /中的java和/ home / app / zookeeper中的zookeeper
要找到它,您可以启动shell并复制粘贴命令行。
似乎主管有时会遇到shell脚本和python脚本的问题,这取决于os / vm等。我还没有找到原因。
但是如果你使用一个独立的命令它可以很好地工作。
我在supervisord中执行zookeeper作为前台进程,在zookeeper log4j配置(仅控制台)中禁用滚动日志并使用supervisord旋转。它完成了这项工作。