kra*_*r65 10 linux daemon ubuntu supervisord
我在Ubuntu 14.04 服务器上运行Supervisord,一切正常。我使用 git push 进行部署,在部署时我还需要重新启动我的应用程序服务器 ( gunicorn ),我应该可以使用supervisorctl
.
un my supervisord.conf
, gunicorn 定义如下:
[program:gunicorn]
command=/home/imb/imb/venv/bin/gunicorn --worker-class eventlet -b 127.0.0.1:5000 -w 1 app:app
directory=/home/imb/imb
autostart=true
autorestart=true
stdout_logfile=/tmp/gunicorn.log
redirect_stderr=true
stopsignal=QUIT
Run Code Online (Sandbox Code Playgroud)
我supervisorctl
是这样启用的:
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
Run Code Online (Sandbox Code Playgroud)
我开始使用主管
sudo supervisord -c /home/imb/imb/supervisord.conf
Run Code Online (Sandbox Code Playgroud)
据我所知,我现在应该能够使用命令重新启动gunicorn supervisorctl restart gunicorn
,但是当我这样做时,我得到
$ supervisorctl restart gunicorn
unix:///var/run/supervisor.sock no such file
Run Code Online (Sandbox Code Playgroud)
我检查了该文件/var/run/supervisor.sock
确实不存在,即使我确定主管实际上正在运行:
$ ps -A | grep supervisor
27211 ? 00:00:00 supervisord
Run Code Online (Sandbox Code Playgroud)
有谁知道为什么/var/run/supervisor.sock
没有创建文件,即使主管显然正在运行?欢迎所有提示!
好吧,在搞乱了一些之后,我发现我做错了什么。
结果是supervisorctl
下面的行,只告诉supervisorctl
它在哪里可以找到套接字文件。
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock
Run Code Online (Sandbox Code Playgroud)
在文件的上方还有另外两行定义文件的实际创建位置:
[unix_http_server]
file=/tmp/supervisor.sock
Run Code Online (Sandbox Code Playgroud)
正如你可以看到创建的套接字文件/tmp/
,同时supervisorctl
试图从读它/var/run/
。我把最后一行改成了file=/var/run/supervisor.sock
,现在它工作得很好。
我希望这个答案可以帮助其他人处理同样的问题。
此外,您可以在评论中查看@MariusMatutiae 提供的链接:https ://stackoverflow.com/questions/10716159/nginx-and-supervisor-setup-in-ubuntu
小智 5
对于具有相同条目的用户
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock
Run Code Online (Sandbox Code Playgroud)
&
[unix_http_server]
file=/tmp/supervisor.sock
Run Code Online (Sandbox Code Playgroud)
请按照以下步骤解决问题 -
希望这对你有帮助!