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

【已解决】supervisord启动出错:Error Another program is already listening on a port that one of our HTTP servers is configured to use

supervisor crifan 12334浏览 0评论

折腾:

【已解决】supervisor去启动gunicorn的Flask出错:supervisor couldn’t setuid to 0 Can’t drop privilege as nonroot user

期间,去尝试运行supervisord,结果出错:

<code>➜  robotDemo sudo supervisorctl stop all
➜  robotDemo sudo supervisorctl stop all
robotDemo: stopped
➜  robotDemo sudo supervisorctl stop all
➜  robotDemo supervisord -n -edebug
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
</code>

去看看,都stop了,还有哪些在占用端口

supervisord Error: Another program is already listening on a port that one of our HTTP servers is configured to use

supervisord – Supervisor on Debian Wheezy: another program is already listening on a port that one of our HTTP servers is configured to use – Stack Overflow

去看自己此处的

.sock

文件

supervisord.conf

<code>[unix_http_server]
file=/tmp/supervisor.sock   ; the path to the socket file
chmod=0766                 ; socket file mode (default 0700)
;chown=nobody:nogroup       ; socket file uid:gid owner
;username=user              ; default is no username (open server)
;password=123               ; default is no password (open server)

[supervisorctl]
serverurl=unix:///tmp/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>➜  robotDemo ps -ef | grep supervisord
  501 10318     1   0 五04下午 ??         6:42.12 /usr/bin/python /Users/crifan/Library/Python/2.7/bin/supervisord -c supervisord.conf
  501  1263  4796   0  9:15上午 ttys007    0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn supervisord
➜  robotDemo kill -s SIGTERM 10318
➜  robotDemo ps -ef | grep supervisord
  501  1278  4796   0  9:16上午 ttys007    0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn supervisord
</code>

然后去试试正常启动是否OK

至少可以正常启动了:

<code>➜  robotDemo supervisord -c supervisord.conf -n -edebug
2018-04-23 09:17:14,697 INFO RPC interface 'supervisor' initialized
2018-04-23 09:17:14,698 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2018-04-23 09:17:14,699 INFO supervisord started with pid 1296
2018-04-23 09:17:15,706 INFO spawned: 'robotDemo' with pid 1299
2018-04-23 09:17:16,712 INFO success: robotDemo entered RUNNING state, process has stayed up for &gt; than 0 seconds (startsecs)
2018-04-23 09:17:16,742 DEBG 'robotDemo' stderr output:
[2018-04-23 09:17:16,739 INFO app.py:59 &lt;module&gt;] api=&lt;flask_restful.Api object at 0x107865a58&gt;
[2018-04-23 09:17:16,740 INFO app.py:59 &lt;module&gt;] api=&lt;flask_restful.Api object at 0x1074649e8&gt;
</code>

【总结】

此处是由于之前启动后,没有杀掉进程,导致此处无法正常启动。

办法是:

找到之前进程,杀掉:

<code>➜  robotDemo ps -ef | grep supervisord
  501 10318     1   0 五04下午 ??         6:42.12 /usr/bin/python /Users/crifan/Library/Python/2.7/bin/supervisord -c supervisord.conf
  501  1263  4796   0  9:15上午 ttys007    0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn supervisord
➜  robotDemo kill -s SIGTERM 10318
</code>

即可正常启动:

<code>➜  robotDemo supervisord -c supervisord.conf -n -edebug
2018-04-23 09:17:14,697 INFO RPC interface 'supervisor’ initialized
2018-04-23 09:17:14,698 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2018-04-23 09:17:14,699 INFO supervisord started with pid 1296
</code>

转载请注明:在路上 » 【已解决】supervisord启动出错:Error Another program is already listening on a port that one of our HTTP servers is configured to use

发表我的评论
取消评论

表情

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

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