【supervisor】unix:///tmp/supervisor.sock no such file

问题

supervisor在正常安装完时运行正常,但隔一段时间后出现了故障,重启后报:
unix:///tmp/supervisor.sock no such file
原因是 supervisor 默认配置会把 socket 文件和 pid 守护进程生成在Linux的/tmp/目录下,/tmp/目录是缓存临时文件的目录,Linux会根据不同情况自动删除其下面的文件。比如缓存超时等,因此我们需要做如下修改:

具体操作如下:

vi /etc/supervisord.conf  

或者

 /etc/supervisor/supervisord.conf 

[unix_http_server]

;file=/tmp/supervisor.sock   ; (the path to the socket file)
file=/var/run/supervisor.sock   ; 修改为 /var/run 目录,避免被系统删除

[supervisord]

;logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile=/var/log/supervisor/supervisord.log ; 修改为 /var/log 目录,避免被系统删除
pidfile=/var/run/supervisord.pid ; 修改为 /var/run 目录,避免被系统删除

[supervisorctl]

; 必须和'unix_http_server'里面的设定匹配
;serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL  for a unix socket
serverurl=unix:///var/run/supervisor.sock ; 修改为 /var/run 目录,避免被系统删除

更新配置文件
supervisorctl update

但是提示

Redirecting to /bin/systemctl start supervisor.service
Failed to start supervisor.service: Unit supervisor.service not found.
 

再执行 supervisorctl 时提示:

[root@xxx run]# supervisorctl
unix:///var/run/supervisor.sock refused connection
supervisor> exit

最后

supervisord -c /etc/supervisord.conf  # 可以直接执行这条命令, 自动创建supervisor.sock

但我的supervisord.conf 文件在 /etc/supervisor/supervisord.conf
因此执行后启动成功

supervisord -c  /etc/supervisor/supervisord.conf 

相关推荐

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-01-25 06:04:03       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-01-25 06:04:03       100 阅读
  3. 在Django里面运行非项目文件

    2024-01-25 06:04:03       82 阅读
  4. Python语言-面向对象

    2024-01-25 06:04:03       91 阅读

热门阅读

  1. ·命令模式

    2024-01-25 06:04:03       42 阅读
  2. 前端语音识别(webkitSpeechRecognition)

    2024-01-25 06:04:03       51 阅读
  3. React 18版本配置rem 和 vw

    2024-01-25 06:04:03       53 阅读
  4. React和Vue的生态系统有何不同?

    2024-01-25 06:04:03       52 阅读
  5. 【react】使用context进行跨级组件数据传递

    2024-01-25 06:04:03       54 阅读
  6. React中antd的使用技巧

    2024-01-25 06:04:03       50 阅读
  7. React 和 Vue的优缺点

    2024-01-25 06:04:03       54 阅读
  8. OpenCV:打开计算机视觉的魔法之门

    2024-01-25 06:04:03       59 阅读
  9. 计算机网络

    2024-01-25 06:04:03       50 阅读