1. 作者QQ:67065435 QQ群:821635552

  2. 本站内容全部为作者原创,转载请注明出处!

  3. 安装supervisor

    yum install epel-release -y
    yum install python-pip -y
    pip install --upgrade pip
    pip install supervisor
  4. 生成配置文件

    echo_supervisord_conf > /etc/supervisord.conf
  5. 修改配置

    ; 进程管理,可以单独写到'/etc/supervisord/*.conf'文件内
    command=[要管理的进程命令]     ; the program (relative uses PATH, can take args)
    process_name=%(program_name)s  ; process_name expr (default %(program_name)s)
    numprocs=1                     ; number of processes copies to start (def 1)
    directory=/tmp                 ; directory to cwd to before exec (def no cwd)
    priority=999                   ; the relative start priority (default 999)
    autostart=true                 ; start at supervisord start (default: true)
    startsecs=1                    ; # of secs prog must stay up to be running (def. 1)
    startretries=5                 ; max # of serial start failures when starting (default 3)
    autorestart=unexpected         ; when to restart if exited after running (def: unexpected)
    user=www                       ; setuid to this UNIX account to run the program
    ; 进程组管理
    programs=进程名1,进程名2       ; each refers to 'x' in [program:x] definitions
    priority=999                   ; the relative start priority (default 999)
    files = /etc/supervisord/*.conf
  6. 完全相同进程启动多个


    process_name=%(program_name)s_%(process_num)02d ;进程名格式
    command=xxxxxxxxx                               ;进程
    autostart=true                                  ;自动启动
    autorestart=true                                ;自动重启
    user=www                                        ;运行用户
    numprocs=8                                      ;进程数
  7. 启动进程管理服务

    supervisord -c /etc/supervisord.conf
  8. 进入进程管理控制台

    supervisorctl -c /etc/supervisord.conf
  9. 启动所有进程

    # 重新加载配置
    supervisor> reload
    # 重新读取进程
    supervisor> reread
    # 启动所有进程
    supervisor> start all
  10. 管理相关命令

    # 重新读取进程
    supervisor> reread
    # 重新加载配置
    supervisor> reload
    # 启动所有进程
    supervisor> start all
    # 停止所有进程
    supervisor> stop all
    # 重启所有进程
    supervisor> restart all
    # 添加进程
    supervisor> add [进程名]
    supervisor> tail   
    supervisor> avail
    supervisor> fg
    supervisor> pid
    supervisor> remove
    supervisor> shutdown
    supervisor> status
    supervisor> update
    supervisor> clear
    # 查看supervisor版本
    supervisor> version
    # 退出supervisor控制台
    supervisor> exit 或 quit
    supervisor> maintail
    supervisor> open
    supervisor> signal
Copyright © 豆包嘿嘿~ 2012-∞ 冀ICP备17033181号 all right reserved,powered by Gitbook修订: 21-06-15 16:29

results matching ""

    No results matching ""