1.
python版本要求2.4以上, 且不能是python3, supervisor不能运行在任何python3版本上。
安装supervisor : brew install supervisor
报错:No such file or directory @ rb_sysopen
查看这个报错上面的依赖包,继续安装。我的是因为缺少python,brew install python@3.10
2.
启动服务:brew services start supervisor
cd /usr/local/etc vi supervisord.conf
找到如下部分: 把前面的注释去掉
[inet_http_server] ; inet (TCP) server disabled by default
port=127.0.0.1:9001 ; ip_address:port specifier, *:port for all iface
username=user ; default is no username (open server)
password=123 ; default is no password (open server)
或者使用sock的方式
sock和pid有关注释掉,并创建对应的文件
3.
创建配置目录 mkdir supervisor.d
目录下创建 laravel_work.ini 文件
文件中复制一下代码
代码语言:javascript复制[program:wechat_xingxiang_tag_student_event]
process_name=%(program_name)s_%(process_num)02d
command=php /apps/webroot/reading-server/artisan queue:work redis --queue {wechat_xingxiang_tag_student_event} --tries=3
autostart=true
autorestart=true
user=worker
numprocs=1
redirect_stderr=true
stdout_logfile=/Users/mac/Desktop/sms/phplog/laravel-queue.log
4.
重启:brew services restart supervisor
载入配置supervisorctl -c /usr/local/etc/supervisord.conf
报错:unix:///usr/local/var/run/supervisor.sock no such file,按照目录创建文件,赋权
代码语言:javascript复制# 创建supervisor.sock
sudo touch /var/run/supervisor.sock
sudo chmod 777 /var/run/supervisor.sock
#重启
brew services restart supervisor