我的个人博客:逐步前行STEP
一、安装supervisor
1、yum install python-setuptools
2、easy_install supervisor
二、配置supervisor
1、echo_supervisord_conf > /etc/supervisord.conf
2、mkdir -p /etc/supervisor/conf.d/
3、/etc/supervisord.conf 在[include]下添加:
files = /etc/supervisor/conf.d/*.conf
三、自动启动
1、下载 CentOS 使用的自动启动服务脚本 centos-systemd-etcs
wget -O /usr/lib/systemd/system/supervisord.service /Supervisor/initscripts/raw/master/centos-systemd-etcs
2、将 supervisord 服务设为自启动
systemctl enable supervisord.service
四、设置 Laravel 队列的进程管理配置
1、新建 /etc/supervisor/conf.d/laravel-work.conf 文件:
[program:laravel-worker]process_name=%(program_name)s_%(process_num)02dcommand=/usr/local/php/bin/php /data/wwwroot//artisan queue:work redis --sleep=3 --tries=3 autostart=trueautorestart=trueuser=wwwnumprocs=8redirect_stderr=truestdout_logfile=/data/wwwroot//storage/logs/queue.log
五、启动
1、启动
supervisord -c /etc/supervisord.conf
2、修改laravel-work配置文件后重新载入
# supervisorctlsupervisorctl> rereadsupervisorctl> updatesupervisorctl> start laravel-worker:*
3、修改/etc/supervisord.conf后重新载入
#supervisorctl reload#supervisorctlsupervisorctl> reload