Supervisorctl错误:unix:///var/run/supervisord.sock拒绝连接?

时间:2013-11-19 08:58:35

标签: unix supervisord supervisor

这是我的配置flie.I运行supervisord -c /etc/supervisor/supervisord.conf它运作良好。 当我尝试运行supervisorctl -c /etc/supervisor/supervisord.conf时,错误发生了:

错误:,serverurl /var/run/supervisord.sock的未知协议:file:/usr/local/lib/python2.7/dist-packages/supervisor-3.0b2-py2.7.egg/supervisor/xmlrpc .py行:440

我可以通过http://127.0.0.1:9001完美地启动或停止我的程序,但我想在命令行中控制程序。任何人都可以帮助我吗?

[unix_http_server]
file = /var/run/supervisor.sock
chmod = 0777
chown= root:cruelcage

[inet_http_server]
port=9001
username = cruelcage
password = 123

[supervisorctl]
serverurl = /var/run/supervisord.sock

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

[supervisord]
logfile=/home/cruelcage/log/supervisord/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB       ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10          ; (num of main logfile rotation backups;default 10)
loglevel=info               ; (log level;default info; others: debug,warn,trace)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=true              ; (start in foreground if true;default false)
minfds=1024                 ; (min. avail startup file descriptors;default 1024)
minprocs=200                ; (min. avail process descriptors;default 200)
#user=root                 ; (default is current user, required if root)
childlogdir=/home/cruelcage/log/supervisord/            ; ('AUTO' child log dir, default $TEMP)

[program:config]
command=python /home/cruelcage/documents/config/config.py
autostart = true
startsecs = 5
user = cruelcage
redirect_stderr = true
stdout_logfile_maxbytes = 20MB
stdoiut_logfile_backups = 20
stdout_logfile = /home/cruelcage/log/debug.log

3 个答案:

答案 0 :(得分:13)

echo_supervisord_conf > /etc/supervisord.conf
sudo supervisord -c /etc/supervisord.conf
sudo supervisorctl status

答案 1 :(得分:10)

您的[supervisorctl] serverurl应为“ unix:// /var/run/supervisord.sock”,因为“/var/run/supervisord.sock”是不是xmlrpclib连接的有效URI。

答案 2 :(得分:0)

我遇到了这个问题,发现它是在服务器重启后发生的。当主管试图在之后重新启动时,找不到我的守护程序配置文件中指定的日志目录(在主管运行时没有出现此问题)。

我需要做的就是在我的文件中更改 stdout_logfile 路径(或注释掉该行):

(将#####替换为您的文件ID)

In [1]: import pip In [2]: pip.main(['install', 'module-name'])

添加现有的日志文件路径或在行的开头用#注释该行:

sudo nano /etc/supervisor/conf.d/daemon-#####.conf

然后重启主管

#stdout_logfile=/my/bad/log/directory