[已解决]运行gunicorn失败:[ERROR] Connection in use 127.0.0.1 8080

最近从新部署了一下应用程序,以后从新运行gunicorn,使用以下命令:python

gunicorn -b 0.0.0.0:8000 manage:app --reload

以后出现了一堆错误,具体错误内容以下:mysql

[2018-06-16 17:04:59 +0800] [24890] [INFO] Starting gunicorn 19.8.1
[2018-06-16 17:04:59 +0800] [24890] [ERROR] Connection in use: ('0.0.0.0', 8000)
[2018-06-16 17:04:59 +0800] [24890] [ERROR] Retrying in 1 second.
[2018-06-16 17:05:00 +0800] [24890] [ERROR] Connection in use: ('0.0.0.0', 8000)
[2018-06-16 17:05:00 +0800] [24890] [ERROR] Retrying in 1 second.
[2018-06-16 17:05:01 +0800] [24890] [ERROR] Connection in use: ('0.0.0.0', 8000)
[2018-06-16 17:05:01 +0800] [24890] [ERROR] Retrying in 1 second.
[2018-06-16 17:05:02 +0800] [24890] [ERROR] Connection in use: ('0.0.0.0', 8000)
[2018-06-16 17:05:02 +0800] [24890] [ERROR] Retrying in 1 second.
[2018-06-16 17:05:03 +0800] [24890] [ERROR] Connection in use: ('0.0.0.0', 8000)
[2018-06-16 17:05:03 +0800] [24890] [ERROR] Retrying in 1 second.
[2018-06-16 17:05:04 +0800] [24890] [ERROR] Can't connect to ('0.0.0.0', 8000)

一直尝试链接8000端口,这个应该是gunicorn没有关闭。nginx

查看一下占用状况:sql

netstat -tulpn

能够看到以下内容:app

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:25672 0.0.0.0:* LISTEN 16528/beam
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 1425/mysqld
tcp 0 0 127.0.0.1:587 0.0.0.0:* LISTEN 9093/sendmail: MTA:
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 20372/nginx -g daem
tcp 0 0 0.0.0.0:4369 0.0.0.0:* LISTEN 16621/epmd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1004/sshd
tcp 0 0 0.0.0.0:15672 0.0.0.0:* LISTEN 16528/beam
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 9093/sendmail: MTA:
tcp 0 0 127.0.0.1:8000 0.0.0.0:* LISTEN 22627/python3.5
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 11530/zabbix_agentd
tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 4093/zabbix_server
tcp6 0 0 :::5672 :::* LISTEN 16528/beam
tcp6 0 0 :::80 :::* LISTEN 20372/nginx -g daem
tcp6 0 0 :::4369 :::* LISTEN 16621/epmd
tcp6 0 0 :::1017 :::* LISTEN 4564/IntelliJIDEALi
tcp6 0 0 :::5050 :::* LISTEN 29792/dotnet
tcp6 0 0 :::10050 :::* LISTEN 11530/zabbix_agentd
tcp6 0 0 :::10051 :::* LISTEN 4093/zabbix_server
udp 0 0 10.104.102.216:123 0.0.0.0:* 1195/ntpd
udp 0 0 127.0.0.1:123 0.0.0.0:* 1195/ntpd
udp 0 0 0.0.0.0:123 0.0.0.0:* 1195/ntpd
udp 0 0 127.0.0.1:161 0.0.0.0:* 1239/snmpd
udp 0 0 0.0.0.0:47718 0.0.0.0:* 1239/snmpd
udp6 0 0 :::123 :::* 1195/ntpd

重点是这个内容:ssh

 

tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 4093/zabbix_server

PID为4093的程序占用了8000端口,直接杀掉进程,命令以下:tcp

kill -9 4093

以后再次运行gunicorn,命令以下:ide

gunicorn -b 0.0.0.0:8000 manage:app --reload

已经成功运行,截图以下:spa

 https://pdf-lib.org/Home/Details/5262server

相关文章
相关标签/搜索