安装命令
# yum install epel-release
# yum install -y supervisor
# systemctl enable supervisord # 开机自启动
# systemctl start supervisord # 启动supervisord服务
# systemctl status supervisord # 查看supervisord服务状态
# ps -ef|grep supervisord # 查看是否存在supervisord进程
修改配置
vi /etc/supervisord.conf
修改加载配置路径
[include]
files = /data/supervisord.d/*.conf
新建配置
vi /data/supervisord.d/redis.conf
[program:redis]#program不能重复
directory = /usr/local/redis/bin #跳转到哪个目录
command=/usr/local/redis/bin/redis-server /usr/local/redis/conf/redis.conf #执行的命令
autostart=true
autorestart=true
user=root
numprocs=1
redirect_stderr=true
stdout_logfile=/data/logs/redis.log
每一次修改配置之后需要执行:
supervisorctl update
查看现在管理的进程
supervisorctl status
启动,停止,重启每个服务
supervisorctl start,stop,restart 服务名