1,配置管理进程
进程管理配置参数,不建议全都写在supervisord.conf文件中,应该每个进程写一个配置文件放在include指定的目录下包含进supervisord.conf文件中。
1> 创建/etc/supervisor/目录,用于存放进程管理的配置文件
2> 修改/etc/supervisord.conf中的include参数,将/etc/supervisor/目录添加到include中
[include]
files = /etc/supervisor/*.ini
在 /etc/supervisor/
目录下建立 redis.ini
文件
[program:redis]
command=/data/redis/src/redis-server /data/redis/redis.conf
autorstart=true
autorestart=true
stdout_logfile=/tmp/supervisor.log
2.重启supervisor
[root@kafka60 supervisor]# supervisorctl status
[root@kafka60 supervisor]# supervisorctl reload
Restarted supervisord
[root@kafka60 supervisor]# supervisorctl status
redis BACKOFF Exited too quickly (process log may have details)
3,子进程管理(supervisorctl)
1) 查看所有子进程的状态:
# supervisorctl status
blog RUNNING pid 2395, uptime 0:08:41
zhoujy RUNNING pid 2396, uptime 0:08:41
2)关闭、开启指定的子进程:
# supervisorctl stop Redis
zhoujy: stopped
# supervisorctl start Redis
zhoujy: started
3)关闭、开启所有的子进程:
# supervisorctl stop all
blog: stopped
zhoujy: stopped
# supervisorctl start all
blog: started
zhoujy: started
4):其他参数:supervisor开启后子进程自动开启(autostart=true)和子进程退出后自动启动(autorestart=ture)