centos 安装supervisor 详解

一 安装 supervisor

执行以下命令

1.yum install python-setuptools
2.easy_install supervisor

 二 配置supervisor

1.创建文件夹和配置文件

mkdir /etc/supervisor
echo_supervisord_conf > /etc/supervisor/supervisord.conf

2.修改/etc/supervisor/supervisord.conf文件内容

在文件结尾[include]节点处
把;files = relative/directory/*.ini
 改为files = conf.d/*.conf

 3.修改配置后重启服务

supervisord -c /etc/supervisor/supervisord.con

 4.在/etc/supervisor/conf.d创建配置文件

 

5.配置开机启动

a.在/usr/lib/systemd/system/目录下创建文件supervisord.service

vim /usr/lib/systemd/system/supervisord.service
[Unit]
Description=Supervisor daemon

[Service]

Type=forking
ExecStart=/usr/bin/supervisord -c /etc/supervisor/supervisord.conf
ExecStop=/usr/bin/supervisorctl shutdown
ExecReload=/usr/bin/supervisorctl reload
KillMode=process
Restart=on-failure
RestartSec=42s

[Install]
WantedBy=multi-user.target

b.手动测试下面流程

执行以下命令:

systemctl enable supervisord

d.验证是否为开机启动:

#提示 enabled 表示成功

systemctl is-enabled supervisord

三 常用命令

service supervisord start #启动

service supervisord stop #停止

service supervisord status #状态

supervisorctl shutdown #关闭所有任务

supervisorctl stop|start program_name #启动或停止服务

supervisorctl status #查看所有任务状态

sudo supervisorctl reread  重启

sudo supervisorctl update  更新

sudo supervisorctl start laravel-worker:* 开启指定队列

你可能感兴趣的:(SRE,linux,centos,linux,运维)