When I run service supervisor start
I run into the following error:
当我运行服务主管时,我遇到以下错误:
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
Content of /var/log/superuser/supervisord.log:
/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
Good-to-know-stuff:
- I use Debian Wheezy on a Digital Ocean server.
- I have tried to check the ports supervisor uses in a clean Vagrant box with the same specs, but I have got the same errors.
-我在数字海洋服务器上使用Debian Wheezy。-我试着检查港口主管在一个有相同规格的干净的漂泊者的箱子里使用,但是我有同样的错误。
How could I check which port is the source of this error?
我怎么检查哪个端口是这个错误的源?
4 个解决方案
#1
38
I solved my problem by unlinking the .sock
file.
我通过打开.sock文件解决了我的问题。
sudo unlink /var/run/supervisor.sock
If this does not help you should check and unlink the file at /tmp/supervisor.sock
.
如果这不能帮助您检查和取消文件的/tmp/监督。
#2
26
Type this in your terminal
在你的终端输入这个。
ps -ef | grep supervisord
You will get some pid of supervisord just like these
你会得到一些像这样的监督。
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
And the PID is 2503
而PID是2503。
Then type this:
然后输入:
kill -s SIGTERM 2503
It should work
它应该工作
#3
5
My situation was a little specific, but this may still be helpful.
我的情况有点具体,但这可能还是有帮助的。
I was running a couple docker containers on the same host. All containers were running in host networking mode. Each container had several processes monitored by supervisor.
我在同一个主机上运行了几个docker容器。所有容器都在主机网络模式下运行。每个容器都有几个由主管监控的过程。
The first container would always come up, and all the others would fail with the warning that the OP mentioned: 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.
第一个容器总是会出现,而其他所有的容器都将失败,并警告说OP提到了:另一个程序已经在监听一个端口,我们的一个HTTP服务器被配置为使用它。在开始监控之前先关闭这个程序。
For me, the issue was that I had the following line in my supervisor config:
对我来说,问题是我在我的主管配置中有如下的一行:
[inet_http_server]
port=127.0.0.1:9001
[supervisorctl]
The first container would successfully bind to port 9001, and each subsequent container would fail to start because they would also try to bind to that same port, which was already taken.
第一个容器将成功地绑定到端口9001,并且每个后续的容器将无法启动,因为它们也会尝试绑定到已经被占用的那个端口。
I replaced these lines with the following, switching from a http server binding on localhost:9001 to a server running on a unix domain socket.
我用下面的方法替换了这些行,从本地主机上的http服务器绑定:9001到运行在unix域套接字上的服务器。
[unix_http_server]
file=/var/run/supervisor.sock
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock
That fixed the port collisions and all the containers were able to start.
固定了港口的碰撞,所有的容器都能启动。
#4
2
Had the same problem here. Solution was that systemctl stop supervisor.service
did not stop the service. supervisord might be still running although you think otherwise.
这里也有同样的问题。解决方案是系统ctl停止主管。服务没有停止服务。虽然你不这么认为,但监管部门可能仍在运行。
Be sure you tried that before manually unlinking the socket.
一定要在手动断开套接字之前尝试过。
I often encountered problems doing /etc/init.d/supervisor restart
although /etc/init.d/supervisor stop && /etc/init.d/supervisor start
works.
我经常遇到一些问题。d /主管虽然/etc/init.重启d /主管& & /etc/init.停止d /主管开始工作。
#1
38
I solved my problem by unlinking the .sock
file.
我通过打开.sock文件解决了我的问题。
sudo unlink /var/run/supervisor.sock
If this does not help you should check and unlink the file at /tmp/supervisor.sock
.
如果这不能帮助您检查和取消文件的/tmp/监督。
#2
26
Type this in your terminal
在你的终端输入这个。
ps -ef | grep supervisord
You will get some pid of supervisord just like these
你会得到一些像这样的监督。
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
And the PID is 2503
而PID是2503。
Then type this:
然后输入:
kill -s SIGTERM 2503
It should work
它应该工作
#3
5
My situation was a little specific, but this may still be helpful.
我的情况有点具体,但这可能还是有帮助的。
I was running a couple docker containers on the same host. All containers were running in host networking mode. Each container had several processes monitored by supervisor.
我在同一个主机上运行了几个docker容器。所有容器都在主机网络模式下运行。每个容器都有几个由主管监控的过程。
The first container would always come up, and all the others would fail with the warning that the OP mentioned: 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.
第一个容器总是会出现,而其他所有的容器都将失败,并警告说OP提到了:另一个程序已经在监听一个端口,我们的一个HTTP服务器被配置为使用它。在开始监控之前先关闭这个程序。
For me, the issue was that I had the following line in my supervisor config:
对我来说,问题是我在我的主管配置中有如下的一行:
[inet_http_server]
port=127.0.0.1:9001
[supervisorctl]
The first container would successfully bind to port 9001, and each subsequent container would fail to start because they would also try to bind to that same port, which was already taken.
第一个容器将成功地绑定到端口9001,并且每个后续的容器将无法启动,因为它们也会尝试绑定到已经被占用的那个端口。
I replaced these lines with the following, switching from a http server binding on localhost:9001 to a server running on a unix domain socket.
我用下面的方法替换了这些行,从本地主机上的http服务器绑定:9001到运行在unix域套接字上的服务器。
[unix_http_server]
file=/var/run/supervisor.sock
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock
That fixed the port collisions and all the containers were able to start.
固定了港口的碰撞,所有的容器都能启动。
#4
2
Had the same problem here. Solution was that systemctl stop supervisor.service
did not stop the service. supervisord might be still running although you think otherwise.
这里也有同样的问题。解决方案是系统ctl停止主管。服务没有停止服务。虽然你不这么认为,但监管部门可能仍在运行。
Be sure you tried that before manually unlinking the socket.
一定要在手动断开套接字之前尝试过。
I often encountered problems doing /etc/init.d/supervisor restart
although /etc/init.d/supervisor stop && /etc/init.d/supervisor start
works.
我经常遇到一些问题。d /主管虽然/etc/init.重启d /主管& & /etc/init.停止d /主管开始工作。