zoukankan      html  css  js  c++  java
  • supervisord

    Supervisor是一个进程管理工具,官方的说法

    用途就是有一个进程需要每时每刻不断的跑,但是这个进程又有可能由于各种原因有可能中断。当进程中断的时候我希望能自动重新启动它,此时,我就需要使用到了Supervisor

     这个工具主要就两个命令:

     supervisord : supervisor的服务器端部分,启动supervisor就是运行这个命令

     supervisorctl:启动supervisor的命令行窗口。

        安装(Centos):

     1.# yum install python-setuptools

    2.# easy_install supervisor

    3.如果easy_install不好使就从官方下载:

    4.然后通过python安装:

    5.# tar zxf supervisor-3.1.3.tar.gz

    6.# cd supervisor

    7.# python setup.py install

    成功安装后可以登陆python控制台输入import supervisor 查看是否能成功加载。

    生成配置文件(supervisord.conf):

    echo_supervisord_conf > /etc/supervisord.conf

    修改配置文件:

    在supervisord.conf最后增加(分号后边的表示注释,可以不写):

    1.[program:bandwidth]

    2.command=python26 /usr/local/bin/bandwidth.sh ;需要执行的命令wd)

    3.user =root ;(default is current user , required if root)

    4.autostart=true ;start at supervisord start (default: true)

    5.autorestart=true ;whether/when to restart (default: unexpected)

    6.startsecs=3 ;number of secs prog must stay running ( def . 1)

    7.stderr_logfile=/tmp/bandwidth_err.log ;redirect proc stderr to stdout (default false) 错误输出重定向

    8.stdout_logfile=/tmp/bandwidth.log ;stdout log path, NONE for none; default AUTO, log输出

    9.(更多配置说明请参考:http://supervisord.org/configuration.html)

    运行命令:

    supervisord -c /etc/supervisord.conf //启动supervisor

    supervisorctl //打开命令行

    1.[root @iZ2365j7l5bZ bin]# supervisorctl status

    2.bandwidth RUNNING pid 2423 , uptime 0 : 06 : 35

    3.[root @iZ2365j7l5bZ bin]# supervisorctl help

    4.

    5.default commands (type help <topic>):

    6.=====================================

    7.add clear fg open quit remove restart start stop update

    8.avail exit maintail pid reload reread shutdown status tail version

    ctl中: help //查看命令

    ctl中: status //查看状态

    另外有一个坑需要注意:如果修改了 /etc/supervisord.conf ,需要执行 supervisorctl reload 来重新加载配置文件,否则不会生效。。。

    生产storm集群上的storm安装

    ## install supervisord

    cd elementtree-1.2.6-20050316

    python setup.py install

    cd ..

    cd meld3-0.6.5

    python setup.py install

    cd ..

    cd setuptools-20.1.1

    python setup.py install

    cd ..

    cd supervisor-3.2.1

    python setup.py install

    cd ..

    ## end install supervisor

  • 相关阅读:
    javascript获取当前url
    外贸电子商务网站之Prestashop 安装后台中文语言包
    外贸电子商务网站之Prestashop paypal支付添加
    外贸电子商务网站之Prestashop 语言包安装
    PHPCMS快速建站系列之邮箱验证
    display: none;、visibility: hidden、opacity=0区别总结
    facebook第三方登录
    PHPCMS V9静态化HTML生成设置及URL规则优化
    Phpcms V9全站伪静态设置方法
    MySQL命令输入错误 取消命令
  • 原文地址:https://www.cnblogs.com/dotagg/p/6363107.html
Copyright © 2011-2022 走看看