supervisor

supervisor 安装启动

2019-12-04  本文已影响0人  梦晓枳

supervisor overview
supervisor配置文件(详细说明)

一、安装supervisor服务

→ wget https://files.pythonhosted.org/packages/de/87/ee1ad8fa533a4b5f2c7623f4a2b585d3c1947af7bed8e65bc7772274320e/supervisor-4.1.0.tar.gz
→ tar -vxf supervisor-4.1.0.tar.gz
→ cd supervisor-4.1.0/
→ python setup.py install
→ yum info supervisor
Loaded plugins: fastestmirror, langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Available Packages
Name        : supervisor
Arch        : noarch
Version     : 3.1.4
Release     : 1.el7
Size        : 446 k
Repo        : epel/7/x86_64
Summary     : A System for Allowing the Control of Process State on UNIX
URL         : http://supervisord.org/
License     : ZPLv2.1 and BSD and MIT
Description : The supervisor is a client/server system that allows its users to control a
            : number of processes on UNIX-like operating systems.           

二、运行supervisord

1. 添加program:

# 直接修改原始默认的supervisord.conf,删掉下面两行注释
[program:theprogramname]
command=/bin/cat              ; the program (relative uses PATH, can take args)
# 然后重启 supervisor服务
supervisorctl reload
# 查看目前supervisor启动的服务
supervisorctl status
theprogramname                   RUNNING   pid 23492, uptime 0:01:55

*根据supervisord的样例,program下面可以配置很多内容,可以根据自己的需要去设置,但是需要注意的是,类似[program:theprogramname]这样用[]括起来的部分认为是一整个“块”,修改的时候,要保证每个快的完整性

2. 启动supervisord服务:

如果不用-c指定配置文件,默认用supervisord supervisord.conf启动supervisord服务,启动时可选参数:

# 指定supervisord服务配置文件的路径
→ supervisord -c FILE
# 前台运行supervisor
→ supervisord -n
# 其他直接使用supervisord -h查看帮助信息
→ supervisord -h
→ supervisorctl status all # =supervisorctl status,查看所有服务状态
→ supervisorctl status serverName # 查看指定服务的状态
→ supervisorctl update # =supervisorctl update all,新加的.ini结尾的新进程(组),update添加进来
→ supervisorctl start/stop/restart serverName # 启动/停止服务(组)
→ supervisorctl start/stop/restart all # 启动/关闭所有服务(组)
→ supervisorctl reload # 重新加载所有服务——重启,如果有新添加的服务也会直接加进来并启动
→ supervisorctl pid # 查看supervisord进程的pid
→ supervisorctl pid serverName # 查看子进程的pid
→ supervisorctl pid all # 查看所有子进程的pid
→ supervisorctl reread # 重新加载已添加服务的configuration配置内容,但是不会重启,也不会自动添加新进程/移除进程,和reload不同
→ supervisorctl fg serverName # 进入子进程的交互模式,Ctrl + C退出,个人觉得不是很好用
→ supervisorctl clear all/serverName # 清除进程的log文件
上一篇 下一篇

猜你喜欢

热点阅读