最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】supervisorctl status all出错:http://localhost:9001 refused connection

supervisor crifan 10652浏览 0评论

折腾:

【已解决】把Python3的Flask部署到远程CentOS7服务器

期间,本地Mac去继续调试Flask期间,已经可以用supervisord正常执行了:

<code>➜  robotDemo supervisord -c supervisord_local.conf
Error: Another program is already listening on a port that one of our HTTP servers is configured to use.  Shut this program down first before starting supervisord.
For help, use /Users/crifan/Library/Python/2.7/bin/supervisord -h
➜  robotDemo ps -ef | grep supervisor
  501 32512     1   0  4:34下午 ??         0:00.17 /usr/bin/python /Users/crifan/Library/Python/2.7/bin/supervisord -c supervisord_local.conf
  501 32923 29937   0  4:43下午 ttys010    0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn supervisor
➜  robotDemo kill -9 32512
➜  robotDemo ps -ef | grep supervisor
  501 32940 29937   0  4:43下午 ttys010    0:00.01 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn supervisor
➜  robotDemo supervisord -c supervisord_local.conf
Unlinking stale socket /var/run/supervisor.sock
</code>

但是结果去看状态却不行:

<code>➜  robotDemo supervisorctl status all
http://localhost:9001 refused connection
</code>

注:之前是正常的。

所以很是奇怪

supervisorctl status http://localhost:9001 refused connection

supervisor 的配置文件的使用 – CSDN博客

“所以在使用supervisorctl 时,如果supervisorctl 无法查找到配置文件,

supervisorctl  无法获知与supervisord 该如何通讯,你可能会看到如下错误”

16.04 – supervisorctl 3.3.1 http://localhost:9001 refused connection – Ask Ubuntu

自己这里的配置文件,和之前一样,没改动过啊:

<code>[supervisorctl]
;serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL  for a unix socket
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL  for a unix socket
;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket
;username=chris              ; should be same as in [*_http_server] if set
;password=123                ; should be same as in [*_http_server] if set
;prompt=mysupervisor         ; cmd line prompt (default "supervisor")
;history_file=~/.sc_history  ; use readline history if available
</code>

不过:

<code>;[inet_http_server]         ; inet (TCP) server disabled by default
;port=127.0.0.1:9001        ; ip_address:port specifier, *:port for all iface
;username=user              ; default is no username (open server)
;password=123               ; default is no password (open server)
</code>

是没有指定的

-》但是之前也没用过啊

supervisord – Supervisorctl not respecting my configuration – Stack Overflow

算了,还是放开inet_http_server试试

结果还没去修改文件呢。

找到原因了:

【总结】

根据官网:

Configuration File — Supervisor 3.3.4 documentation

supervisorctl运行时,(和supervisord一样)也需要用-c去指定配置文件

而此处之所以:

之前没有加上-c xxx.config,直接运行:

supervisorctl status all

也正常的,那是因为:

之前的时候,当前项目所在目录下,就有且只有一个配置文件,叫做:

supervisord.conf

是在supervisord的官方搜索路径之内:

当前文件夹下面的

supervisord.conf

而现在去运行:

supervisorctl status all

之所以报错是因为:

此时,当前文件夹下,没有了:

supervisord.conf

而有另外2个:

supervisord_local.conf

supervisord_server.conf

<code>➜  robotDemo ll
...
-rw-r--r--  1 crifan  staff    10K  4 24 16:53 supervisord_local.conf
-rw-r--r--  1 crifan  staff   592B  4 24 16:07 supervisord_server.conf
</code>

但是supervisorctl无法识别。

所以才报错的。

所以,加上参数去运行就可以了:

<code>➜  robotDemo supervisorctl -c supervisord_local.conf status all
robotDemo                        RUNNING   pid 32957, uptime 0:14:32
</code>

转载请注明:在路上 » 【已解决】supervisorctl status all出错:http://localhost:9001 refused connection

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
82 queries in 0.159 seconds, using 22.19MB memory