docker 监督员控制:在运行supervorctl状态下发

mxg2im7a  于 2023-02-03  发布在  Docker
关注(0)|答案(1)|浏览(139)

我的Supervisord配置如下所示

abc@abc-adhocworker-c89d9667b-9lqbd:/app$ cat worker.conf 
[supervisord]
logfile=/dev/null
pidfile=/tmp/supervisord.pid
nodaemon=true

[unix_http_server]
file = /tmp/supervisor.sock

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[program:worker]
command=./manage.py rq worker %(ENV_QUEUES)s
process_name=%(program_name)s-%(process_num)s
numprocs=%(ENV_WORKERS_COUNT)s
directory=/app
stopsignal=TERM
autostart=true
autorestart=true
startsecs=300
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[eventlistener:worker_healthcheck]
autorestart=true
serverurl=AUTO
command=./manage.py rq healthcheck
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
events=TICK_60

收到此错误

Error: .ini file does not include supervisorctl section
For help, use /usr/local/bin/supervisorctl -h

我尝试添加上述配置

[supervisorctl]
serverurl=http://127.0.0.1:9001

然后在运行supervisorctl status时收到错误

abc@abc-adhocworker-c89d9667b-9lqbd:/app$ /usr/local/bin/python /usr/local/bin/supervisorctl status
error: <class 'OSError'>, [Errno 99] Cannot assign requested address: file: /usr/local/lib/python3.7/socket.py line: 716

还试着把它改成

serverurl=unix:///tmp/supervisor.sock

不确定更改配置后是否需要重新启动/重新加载supervisord?
注意:我在Docker容器中运行这些命令。

3vpjnl9f

3vpjnl9f1#

运行监督控制状态

  • 使用exec执行
  • 还使用-c指定supervisord配置
abc@abc-adhocworker-c89d9667b-9lqbd:/app$ exec supervisorctl -c worker.conf status
worker:worker-0                  STARTING  
worker:worker-1                  FATAL     Exited too quickly (process log may have details)
worker_healthcheck               RUNNING   pid 14, uptime 7:49:44

确保添加supervisorctl部分

serverurl,套接字文件在supervisord.conf中的位置(在我的例子中,它被命名为worker.conf

[supervisorctl]
serverurl=unix:///tmp/supervisor.sock

相关问题