美文网首页
issues installing supervisor

issues installing supervisor

作者: 段义纬 | 来源:发表于2019-08-10 17:56 被阅读0次

1、安装supervisor的时候,遇到了一些问题

  • 比如:

unix:///var/run/supervisor.sock no such file
unix:///var/run/supervisor.sock refused connection
pkg_resources.VersionConflict: (supervisor 4.0.4 (/usr/local/lib/python3.7/dist-packages), Requirement.parse('supervisor==3.3.1'))
……

2、解决:不用apt-get直接安装,可能是源没有supervisor 4.0.4版本

  • 环境:
 % lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.2 LTS
Release:        18.04
Codename:       bionic

 % python -V
Python 3.6.8
  • 步骤,注意版本号

安装python包

sudo python3.6 -m pip install supervisor==4.0.4

从git下载supervisor,解压并cd进去

wget -O supervisor-4.0.4.zip https://github.com/Supervisor/supervisor/tree/4.0.4
unzip supervisor-4.0.4.zip 
cd supervisor-4.0.4
sudo python -m setup.py install

仅记一下配置

; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock   ; (the path to the socket file)
chmod=0700                       ; sockef file mode (default 0700)

[supervisord]
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=/var/log/supervisor            ; ('AUTO' child log dir, default $TEMP)
; the below section must remain in the config file for RPC
; (supervisorctl/web interface) to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL  for a unix socket

; The [include] section can just contain the "files" setting.  This
; setting can list multiple files (separated by whitespace or
; newlines).  It can also contain wildcards.  The filenames are
; interpreted as relative to this file.  Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf

根据配置生成日志文件夹

sudo mkdir -p /var/log/supervisor/
sudo touch /var/log/supervisor/supervisord.log

好了

sudo supervisord
sudo supervisorctl restart

操作命令
http://supervisord.org/running.html

3、配置队列

sudo vim /etc/supervisor/conf.d/laravel-worker.conf

[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /mnt/g/Workplace/explore/php/blog/artisan queue:work --sleep=3 --tries=3 --queue=default,high
autostart=true
autorestart=true
user=kael
numprocs=8
redirect_stderr=true
stdout_logfile=/mnt/g/Workplace/explore/php/blog/storage/supervisor.log

sudo supervisorctl reread

sudo supervisorctl update

sudo supervisorctl start laravel-worker:*

相关文章

网友评论

      本文标题:issues installing supervisor

      本文链接:https://www.haomeiwen.com/subject/uegrjctx.html