大佬教程收集整理的这篇文章主要介绍了CentOS 安装 supervisor 以及设置 Laravel 队列设置,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
先安装 Python 的 easy_install
,再通过 easy_install 安装 supervisor
# yum install python-setuptools
# easy_install supervisor
# echo_supervisord_conf > /etc/supervisord.conf
在 https://github.com/Supervisor/initscripts 下载 CentOS 使用的自动启动服务脚本 centos-systemd-etcs
# wget -O /usr/lib/systemd/system/supervisord.service https://github.com/Supervisor/initscripts/raw/master/centos-systemd-etcs
将 supervisord
服务设为自启动
# systemctl enable supervisord.service
启动 supervisord
# supervisord -c /etc/supervisord.conf
输入 supervisorctl 命令可以进入 supervisor 控制台
编辑 /etc/supervisord.conf
,在在文件结尾添加如下内容
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=/usr/local/PHP/bin/PHP /data/wwwroot/app.com/artisan queue:work database --sleep=3 --tries=3 --daemon
autostart=true
autorestart=true
user=root
numprocs=8
redirect_stderr=true
stdout_logfile=/data/wwwroot/app.com/storage/logs/queue.log
这里开启了 8 个 queue:work 进程,并监视他们,如果失败的话,自动重启;在项目的 storage/logs/queue.log 记录日志。
执行以下命令更新 supervisor 配置并启动进程:
# supervisord -c /etc/supervisord.conf
# supervisorctl -c /etc/supervisord.conf
# supervisorctl reread
# supervisorctl update
# supervisorctl start laravel-worker:*
至此, supervisor 安装及 Laravel 队列设置完毕
以上是大佬教程为你收集整理的CentOS 安装 supervisor 以及设置 Laravel 队列设置全部内容,希望文章能够帮你解决CentOS 安装 supervisor 以及设置 Laravel 队列设置所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。