Laravel使用Supervisor监控队列运行

1# 安装Supervisor

sudo yum install supervisor

2# 在Supervisor中添加队列配置文件

cd /etc/supervisord.d/laravel-worker.ini
vim test.ini
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=/usr/local/php/bin/php /home/forge/app.com/artisan queue:work sqs --sleep=3 --tries=3 (修改)
autostart=true
autorestart=true
user=forge(修改)
numprocs=8
redirect_stderr=true
stdout_logfile=/home/forge/app.com/worker.log (修改)

3# 运行supervisor

sudo supervisord -c /etc/supervisor/supervisord.conf
sudo supervisorctl -c /etc/supervisor/supervisord.conf
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start laravel-worker:*

4# 如出现“laravel-worker:laravel-worker_00: ERROR (spawn error)”等错误,去“/var/log/supervisor”目录查看错误信息

发表评论

电子邮件地址不会被公开。