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

【已解决】部署Flask时运行supervisorctl出错:unix:///var/run/supervisor/supervisor.sock no such file

supervisor crifan 311浏览 0评论
折腾:
【未解决】部署测评系统Flask后台到在线服务器
期间,结果部署supervisor期间出错:
(xxx-on-MIKE7) [[email protected] supervisord.d]# rz
rz waiting to receive.
Starting zmodem transfer.  Press Ctrl+C to cancel.
Transferring supervisord_xxx.conf...
  100%     709 bytes  709 bytes/sec 00:00:01       0 Errors  

(xxx-on-MIKE7) [[email protected] supervisord.d]# ll
total 12
-rw-r--r-- 1 root root  709 Dec 21 17:28 supervisord_xxx.conf
-rw-r--r-- 1 root root  477 Dec 13 10:17 supervisord_xxx.conf
-rw-r--r-- 1 root root 3250 Oct 31 20:15 supervisord_server.conf
(xxx-on-MIKE7) [[email protected] supervisord.d]# ls -lh
total 12K
-rw-r--r-- 1 root root  709 Dec 21 17:28 supervisord_xxx.conf
-rw-r--r-- 1 root root  477 Dec 13 10:17 supervisord_xxx.conf
-rw-r--r-- 1 root root 3.2K Oct 31 20:15 supervisord_server.conf
(xxx-on-MIKE7) [[email protected] supervisord.d]# pwd
/etc/supervisord.d
(xxx-on-MIKE7) [[email protected] supervisord.d]# ls -lh
total 12K
-rw-r--r-- 1 root root  709 Dec 21 17:28 supervisord_xxx.conf
-rw-r--r-- 1 root root  477 Dec 13 10:17 supervisord_xxx.conf
-rw-r--r-- 1 root root 3.2K Oct 31 20:15 supervisord_server.conf
(xxx-on-MIKE7) [[email protected] supervisord.d]# supervisorctl status
xxx               RUNNING   pid 31305, uptime 8 days, 2:40:15
StorybookQueryServer             RUNNING   pid 31304, uptime 8 days, 2:40:15
redis                            RUNNING   pid 31303, uptime 8 days, 2:40:15
robotDemo                        RUNNING   pid 31301, uptime 8 days, 2:40:15
robotDemo_CeleryBeat             RUNNING   pid 31302, uptime 8 days, 2:40:15
robotDemo_CeleryWorker           RUNNING   pid 31300, uptime 8 days, 2:40:15
(xxx-on-MIKE7) [[email protected] supervisord.d]# supervisorctl reload
Restarted supervisord
(xxx-on-MIKE7) [[email protected] supervisord.d]# supervisorctl status
error: <class 'xmlrpclib.Fault'>, <Fault 6: 'SHUTDOWN_STATE'>: file: /usr/lib64/python2.7/xmlrpclib.py line: 794
(xxx-on-MIKE7) [[email protected] supervisord.d]# supervisorctl status
unix:///var/run/supervisor/supervisor.sock no such file
(xxx-on-MIKE7) [[email protected] supervisord.d]# 
参考自己之前的帖子,去试:
(xxx-on-MIKE7) [[email protected] supervisord.d]# supervisorctl stop all
unix:///var/run/supervisor/supervisor.sock no such file
搜:
supervisorctl unix:///var/run/supervisor/supervisor.sock no such file
unix:///var/run/supervisor.sock no such file · Issue #480 · Supervisor/supervisor
unix:///var/run/supervisor.sock no such file on Ubuntu 16.04 · Issue #735 · Supervisor/supervisor
ll /var/run/supervisor/
total 0
supervisor安装和自启动的一些问题 – 简书
去启动试试?
(xxx-on-MIKE7) [[email protected] nlp]# supervisorctl start all
unix:///var/run/supervisor/supervisor.sock no such file
(xxx-on-MIKE7) [[email protected] nlp]# touch /var/run/supervisor/supervisor.sock
(xxx-on-MIKE7) [[email protected] nlp]# supervisorctl start all                  
unix:///var/run/supervisor/supervisor.sock refused connection
(xxx-on-MIKE7) [[email protected] nlp]# rm /var/run/supervisor/supervisor.sock
rm: remove regular empty file ‘/var/run/supervisor/supervisor.sock’? f
然后:
[[email protected] xxx]# systemctl start supervisord
Job for supervisord.service failed because the control process exited with error code. See "systemctl status supervisord.service" and "journalctl -xe" for details.
[[email protected] xxx]# journalctl -xe
Dec 21 17:46:29 xxx-general-01 sshd[5295]: pam_unix(sshd:session): session opened for user git by (uid=0)
Dec 21 17:46:29 xxx-general-01 sshd[5297]: Received disconnect from 222.92.130.218 port 59482:11: disconnected by user
Dec 21 17:46:29 xxx-general-01 sshd[5297]: Disconnected from 222.92.130.218 port 59482
Dec 21 17:46:29 xxx-general-01 sshd[5295]: pam_unix(sshd:session): session closed for user git
Dec 21 17:46:29 xxx-general-01 systemd-logind[504]: Removed session 38321.
-- Subject: Session 38321 has been terminated
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Documentation: http://www.freedesktop.org/wiki/Software/systemd/multiseat
-- 
-- A session with the ID 38321 has been terminated.
Dec 21 17:46:29 xxx-general-01 systemd[1]: Removed slice User Slice of git.
-- Subject: Unit user-1001.slice has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit user-1001.slice has finished shutting down.
Dec 21 17:46:29 xxx-general-01 systemd[1]: Stopping User Slice of git.
-- Subject: Unit user-1001.slice has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit user-1001.slice has begun shutting down.
Dec 21 17:48:17 xxx-general-01 polkitd[505]: Registered Authentication Agent for unix-process:5322:1909838865 (system bus name :1.76701 [/usr/bin/pkttyagent --notify-fd 5 --fallbac
Dec 21 17:48:17 xxx-general-01 systemd[1]: Starting Process Monitoring and Control Daemon...
-- Subject: Unit supervisord.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit supervisord.service has begun starting up.
Dec 21 17:48:17 xxx-general-01 supervisord[5328]: Error: The directory named as part of the path /root/xxx_20180101/web/server/xxx/logs/supervisord-Evaluat
Dec 21 17:48:17 xxx-general-01 supervisord[5328]: For help, use /usr/bin/supervisord -h
Dec 21 17:48:17 xxx-general-01 systemd[1]: supervisord.service: control process exited, code=exited status=2
Dec 21 17:48:17 xxx-general-01 systemd[1]: Failed to start Process Monitoring and Control Daemon.
-- Subject: Unit supervisord.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit supervisord.service has failed.
-- 
-- The result is failed.
Dec 21 17:48:17 xxx-general-01 systemd[1]: Unit supervisord.service entered failed state.
Dec 21 17:48:17 xxx-general-01 systemd[1]: supervisord.service failed.
Dec 21 17:48:17 xxx-general-01 polkitd[505]: Unregistered Authentication Agent for unix-process:5322:1909838865 (system bus name :1.76701, object path /org/freedesktop/PolicyKit1/A
[[email protected] xxx]# 
好像是log文件路径的问题?
去新建logs文件夹后试试
[[email protected] xxx]# mkdir logs
[[email protected] xxx]# pwd
/root/xxx_20180101/web/server/xxx
[[email protected] xxx]# ll -lh
total 60K
-rw-r--r-- 1 root root 1.4K Dec 21 16:44 app.py
drwxr-xr-x 2 root root 4.0K Dec 21 16:44 common
drwxr-xr-x 5 root root 4.0K Dec 21 16:44 conf
drwxr-xr-x 2 root root 4.0K Dec 21 16:44 deploy
-rw-r--r-- 1 root root 4.6K Dec 21 16:44 factory.py
drwxr-xr-x 2 root root 4.0K Dec 21 17:49 logs
-rw-r--r-- 1 root root  374 Dec 21 16:44 Pipfile
-rw-r--r-- 1 root root  17K Dec 21 16:48 Pipfile.lock
-rw-r--r-- 1 root root 2.5K Dec 21 16:44 README.md
drwxr-xr-x 2 root root 4.0K Dec 21 16:44 resources

然后就可以了:
[[email protected] xxx]# systemctl start supervisord
[[email protected] xxx]# systemctl status supervisord
● supervisord.service - Process Monitoring and Control Daemon
   Loaded: loaded (/usr/lib/systemd/system/supervisord.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2018-12-21 17:50:05 CST; 14s ago
  Process: 5389 ExecStart=/usr/bin/supervisord -c /etc/supervisord.conf (code=exited, status=0/SUCCESS)
 Main PID: 5392 (supervisord)
   CGroup: /system.slice/supervisord.service
           ├─5392 /usr/bin/python /usr/bin/supervisord -c /etc/supervisord.conf
           ├─5393 /root/.local/share/virtualenvs/robotDemo-dwdcgdaG/bin/python3.6m /root/.local/share/virtualenvs/robotDemo-dwdcgdaG/bin/celery worker -A resources.tasks.celery
           ├─5395 /root/.local/share/virtualenvs/robotDemo-dwdcgdaG/bin/python3.6m /root/.local/share/virtualenvs/robotDemo-dwdcgdaG/bin/celery beat -A resources.tasks.celery --pidfil...
           ├─5396 /usr/bin/redis-server 127.0.0.1:6379
           ├─5397 /root/.local/share/virtualenvs/StorybookQueryServer-se4mevDU/bin/python3.6m /root/.local/share/virtualenvs/StorybookQueryServer-se4mevDU/bin/gunicorn -c conf/gunicor...
           ├─5398 /usr/bin/python3 /usr/bin/gunicorn --workers 4 --bind unix:/root/xxx_20180101/web/server/xxx.sock xxx.wsgi
           ├─5399 /root/.local/share/virtualenvs/xxx-on-MIKE7/bin/python3.6m /root/.local/share/virtualenvs/xxx-on-MIKE7/bin/gunicorn -c conf/gun...
           ├─5410 /usr/bin/python3 /usr/bin/gunicorn --workers 4 --bind unix:/root/xxx_20180101/web/server/xxx.sock xxx.wsgi
           ├─5413 /usr/bin/python3 /usr/bin/gunicorn --workers 4 --bind unix:/root/xxx_20180101/web/server/xxx.sock xxx.wsgi
           ├─5414 /root/.local/share/virtualenvs/xxx-on-MIKE7/bin/python3.6m /root/.local/share/virtualenvs/xxx-on-MIKE7/bin/gunicorn -c conf/gun...
           ├─5415 /usr/bin/python3 /usr/bin/gunicorn --workers 4 --bind unix:/root/xxx_20180101/web/server/xxx.sock xxx.wsgi
           ├─5416 /usr/bin/python3 /usr/bin/gunicorn --workers 4 --bind unix:/root/xxx_20180101/web/server/xxx.sock xxx.wsgi
           ├─5431 /root/.local/share/virtualenvs/StorybookQueryServer-se4mevDU/bin/python3.6m /root/.local/share/virtualenvs/StorybookQueryServer-se4mevDU/bin/gunicorn -c conf/gunicor...
           ├─5440 /root/.local/share/virtualenvs/robotDemo-dwdcgdaG/bin/python3.6m /root/.local/share/virtualenvs/robotDemo-dwdcgdaG/bin/celery worker -A resources.tasks.celery
           ├─5441 /root/.local/share/virtualenvs/robotDemo-dwdcgdaG/bin/python3.6m /root/.local/share/virtualenvs/robotDemo-dwdcgdaG/bin/celery worker -A resources.tasks.celery
           ├─5442 /root/.local/share/virtualenvs/robotDemo-dwdcgdaG/bin/python3.6m /root/.local/share/virtualenvs/robotDemo-dwdcgdaG/bin/celery worker -A resources.tasks.celery
           └─5443 /root/.local/share/virtualenvs/robotDemo-dwdcgdaG/bin/python3.6m /root/.local/share/virtualenvs/robotDemo-dwdcgdaG/bin/celery worker -A resources.tasks.celery

Dec 21 17:50:05 xxx-general-01 systemd[1]: Starting Process Monitoring and Control Daemon...
Dec 21 17:50:05 xxx-general-01 supervisord[5389]: Unlinking stale socket /var/run/supervisor/supervisor.sock
Dec 21 17:50:05 xxx-general-01 systemd[1]: Started Process Monitoring and Control Daemon.
[[email protected] xxx]# supervisorctl status
xxx           RUNNING   pid 5399, uptime 0:00:22
xxx               RUNNING   pid 5398, uptime 0:00:22
StorybookQueryServer             RUNNING   pid 5397, uptime 0:00:22
redis                            RUNNING   pid 5396, uptime 0:00:22
robotDemo                        RUNNING   pid 5512, uptime 0:00:00
robotDemo_CeleryBeat             RUNNING   pid 5395, uptime 0:00:22
robotDemo_CeleryWorker           RUNNING   pid 5393, uptime 0:00:22

【总结】
此处,好像是由于supervisord的配置中,指定了log文件,但是log文件夹:
/root/xxx_20180101/web/server/xxx/logs
不存在,导致启动失败。
但是报错却是报的:
unix:///var/run/supervisor/supervisor.sock no such file
-》误导了错误方向
-》后来是从:
systemctl start supervisord
journalctl -xe
而找到了好像是log文件的目录方面的问题。

解决办法:
去新建了对应的文件夹:
cd /root/xxx_20180101/web/server/xxx
mkdir logs
即可正常启动:
systemctl start supervisord
systemctl status supervisord
了。

转载请注明:在路上 » 【已解决】部署Flask时运行supervisorctl出错:unix:///var/run/supervisor/supervisor.sock no such file

发表我的评论
取消评论

表情

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

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
86 queries in 0.120 seconds, using 20.57MB memory