Debian Wheezy的主管:另一个程序已经在侦听我们的一个HTTP服务器配置使用的端口

bal*_*ant 44 debian supervisord

当我运行时service supervisor start遇到以下错误:

Starting supervisor: 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 /usr/bin/supervisord -h
Run Code Online (Sandbox Code Playgroud)

/var/log/superuser/supervisord.log的内容:

2014-08-04 16:25:45,891 CRIT Supervisor running as root (no user in config file)
2014-08-04 16:25:45,891 WARN Included extra file "/etc/supervisor/conf.d/com.domain.subdomain.conf" during parsing
Run Code Online (Sandbox Code Playgroud)

知识
渊博的东西: - 我在数字海洋服务器上使用Debian Wheezy.
- 我试图检查端口管理程序在具有相同规格的干净Vagrant框中使用,但我有相同的错误.

我怎样才能检查哪个端口是此错误的来源?

bal*_*ant 60

我通过取消链接.sock文件解决了我的问题.

sudo unlink /var/run/supervisor.sock
Run Code Online (Sandbox Code Playgroud)

如果这没有帮助,您应该检查并取消链接文件/tmp/supervisor.sock.

  • @ .sock文件是一个特殊文件,它是用于进程间联网的unix域套接字-您可以在此处查看更多信息-https://en.wikipedia.org/wiki/Unix_domain_socket (2认同)
  • 这不是一个好主意,如果supervisord仍在运行,你会丢失pid并且你的supervisord将永远运行。这个答案是最好的:/sf/answers/2820258101/ (2认同)

小智 43

在您的终端中输入此内容

ps -ef | grep supervisord
Run Code Online (Sandbox Code Playgroud)

你会得到一些像这样的监督

root   2503  1  0 Nov19 ?  00:03:23 /usr/bin/python /usr/bin/supervisord
root   21337 2556  0 18:15 pts/8   00:00:00 grep --color=auto supervisord
Run Code Online (Sandbox Code Playgroud)

PID为2503

然后键入:

kill -s SIGTERM 2503  
Run Code Online (Sandbox Code Playgroud)

它应该工作


kar*_*bal 7

这里有同样的问题。解决方案是systemctl stop supervisor.service没有停止服务。尽管您不这么认为,但supervisord 可能仍在运行

确保在手动取消连接套接字之前尝试过。

/etc/init.d/supervisor restart虽然/etc/init.d/supervisor stop && /etc/init.d/supervisor start有效,但我经常遇到问题。


tur*_*nvh 6

我的情况有点具体,但这可能仍然有用.

我在同一台主机上运行了几个docker容器.所有容器都以主机网络模式运行.每个容器都有几个由主管监控的过程.

第一个容器总会出现,而其他所有容器都会因OP提到的警告而失败: 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.

对我来说,问题是我的主管配置中有以下行:

[inet_http_server]
port=127.0.0.1:9001

[supervisorctl]
Run Code Online (Sandbox Code Playgroud)

第一个容器将成功绑定到端口9001,并且每个后续容器都将无法启动,因为它们也会尝试绑定到已经采用的同一个端口.

我用以下内容替换了这些行,从localhost:9001上的http服务器绑定切换到在unix域套接字上运行的服务器.

[unix_http_server]
file=/var/run/supervisor.sock

[supervisorctl]
serverurl=unix:///var/run/supervisor.sock
Run Code Online (Sandbox Code Playgroud)

这修复了端口冲突,所有容器都能够启动.


Bra*_*mon 5

与@ N'falyKaba的答案类似,但也许更直接一些,对于新版本的Supervisor,您可以supervisorctl pid用来获取pid,杀死它并重新启动:

$ kill -s SIGTERM $(supervisorctl pid)
Run Code Online (Sandbox Code Playgroud)

重启:

$ supervisord -c /path/to/supervisord.conf
Run Code Online (Sandbox Code Playgroud)

资料来源:docs