分类 supervisor 下的文章

我的个人博客:逐步前行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  https://github.com/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)02d
command=/usr/local/php/bin/php /data/wwwroot/app.com/artisan queue:work redis --sleep=3 --tries=3 
autostart=true
autorestart=true
user=www
numprocs=8
redirect_stderr=true
stdout_logfile=/data/wwwroot/app.com/storage/logs/queue.log

五、启动
1、启动

supervisord -c /etc/supervisord.conf

2、修改laravel-work配置文件后重新载入

# supervisorctl
supervisorctl> reread
supervisorctl> update
supervisorctl> start laravel-worker:*

3、修改/etc/supervisord.conf后重新载入

#supervisorctl reload
#supervisorctl
supervisorctl> reload