Installing Supervisor1 and Superlance2 on CentOS/RHEL/Fedora can be a little tricky, as the versions of those packages included in the main repositories are too old to be useful.

In this tutorial, I will show you how to make a stock install of the latest versions on CentOS, and will omit the configuration of Supervisor itself as that will be specific to your applications.

Installing Supervisor

As the super user, firstly install the Python setup tools to gain EasyInstall3, then use that to install Supervisor:

$ yum install python-setuptools
$ easy_install supervisor

You should now have the latest version installed:

$ supervisord --version
3.1.

Create a config file

Easy Install will not create a config file for Supervisor for you, but luckily Supervisor includes a utility called echo_supervisord_conf to generate a default configi file for you:

$ echo_supervisord_conf > /etc/supervisord.conf

You can now make changes directly to the new /etc/supervisord.conf file.

Running the service

While it is possible to start Supervisor using the supervisord command, I like to run services via an init script. Here is an example I use (placed in /etc/rc.d/init.d/supervisord):

#!/bin/bash

. /etc/init.d/functions

DAEMON=/usr/bin/supervisord
PIDFILE=/var/run/supervisord.pid [ -x "$DAEMON" ] || exit start() {
echo -n "Starting supervisord: "
if [ -f $PIDFILE ]; then
PID=`cat $PIDFILE`
echo supervisord already running: $PID
exit ;
else
daemon $DAEMON --pidfile=$PIDFILE -c /etc/supervisord.conf
RETVAL=$?
echo
[ $RETVAL -eq ] && touch /var/lock/subsys/supervisord
return $RETVAL
fi } stop() {
echo -n "Shutting down supervisord: "
echo
killproc -p $PIDFILE supervisord
echo
rm -f /var/lock/subsys/supervisord
return
} case "$1" in
start)
start
;;
stop)
stop
;;
status)
status supervisord
;;
restart)
stop
start
;;
*)
echo "Usage: {start|stop|status|restart}"
exit
;;
esac
exit $?

You will need to create that file, containing the above script, and make sure it's executable:

$ nano /etc/rc.d/init.d/supervisord
$ chmod /etc/rc.d/init.d/supervisord

You will now have access to the following commands to control Supervisor:

$ service supervisord start
$ service supervisord stop
$ service supervisord status
$ service supervisord restart

Superlance

Superlance is a set of additional plugins for Supervisor, that includes plugins for sending email or SMS alerts when a Supervisor process exists unexpectedly, for monitoring memory usage of Supervisor processes, and a few other useful monitoring and alerting utilities. You can also install it via EasyInstall:

$ easy_install superlance

References

Installing Supervisor and Superlance on CentOS的更多相关文章

  1. Installing Zabbix 3.2 in Centos 6.8 Clean Install Dependencies Errors

    ZABBIX Forums > Zabbix Discussions and Feedback > Zabbix Troubleshooting and Problems > Ins ...

  2. [转]Installing python 2.7 on centos 6.3. Follow this sequence exactly for centos machine only

    Okay for centos 6.4 also On apu.0xdata.loc, after this install was done $ which python /usr/local/bi ...

  3. Installing IPython using pip on CentOS

    1. First to install pip # wget https://bootstrap.pypa.io/get-pip.py # python get-pip.py 2. Install i ...

  4. Installing Percona XtraDB Cluster on CentOS

    PXC简介 Percona XtraDB Cluster(简称PXC集群)提供了MySQL高可用的一种实现方法. 1.集群是有节点组成的,推荐配置至少3个节点,但是也可以运行在2个节点上. 2.每个节 ...

  5. 使用superlance插件增强supervisor的监控能力

    supervisor与superlance简介 supervisor是一款用python编写的进程监控.进程守护和进程管理的工具,可以工作在各种UNIX-like的操作系统上,通过简单的配置就可以启动 ...

  6. 利用superlance监控supervisor运行状态

    此文已由作者张家裕授权网易云社区发布. 欢迎访问网易云社区,了解更多网易技术产品运营经验. 最近开发问到supervisor管理下的进程重启了,有无办法做到主动通知,楼主最先想到的是superviso ...

  7. 利用Superlance监控Supervisor运行状态并实现报警

    Superlance是基于supervisor的事件机制实现的一系列命令行的工具集,它实现了许多supervisor本身没有实现的实用的进程监控和管理的特性,包括内存监控,http接口监控,邮件和短信 ...

  8. 在Linux CentOS 6.6上安装Python 2.7.9

    CentOS 6.6自带的是Python 2.6.6,而编译llvm需要Python 2.7以上. checking for python... /usr/bin/python checking fo ...

  9. How to install Wordpress 4.0 on CentOS 7.0

    This document describes how to install and configure Wordpress 4.0 on CentOS 7.0. WordPress started ...

随机推荐

  1. 初识Shiro

    Shiro是Apache基金会下的一个开源安全框架,提供了身份验证.授权.密码学和会话管理等功能,Shiro框架不仅直观易用,而且也能提供健壮的安全性,另外一点值得说的是Shiro的前身是一个始于20 ...

  2. 基础才是重中之重~Dictionary<K,V>里V的设计决定的性能

    回到目录 字典对象Dictionary<K,V>我们经常会用到,而在大数据环境下,字典使用不当可能引起性能问题,严重的可能引起内在的溢出! 字典的值建议为简单类型,反正使用Tuple< ...

  3. ASP.NET Core中使用表达式树创建URL

    当我们在ASP.NET Core中生成一个action的url会这样写: var url=_urlHelper.Action("Index", "Home"); ...

  4. PE知识复习之PE的重定位表

    PE知识复习之PE的重定位表 一丶何为重定位 重定位的意思就是修正偏移的意思.  如一个地址位 0x401234 ,Imagebase = 0x400000 . 那么RVA就是 1234.  如果Im ...

  5. RDIFramework.NET ━ .NET快速信息化系统开发框架 V3.2->新增“行政区域管理”,同时大批量树采用异步加载

    行政区划:简称政区,是国家为了进行分级管理而实行的区域划分.中国现行的行政区划实行如下原则:1.全国分为省.自治区.直辖市:2.省.自治区分为自治州.县.自治县.市:3.自治州分为县.自治县.市:4. ...

  6. Mybatis源码之StatementType

      在mybatis中StatementType的值决定了由什么对象来执行我们的SQL语句.本文来分析下在mybatis中具体是怎么处理的. StatementType 1.StatementType ...

  7. 基于.Net进行前端开发的技术栈发展路线(三)

    前言 上一篇<我的技能树二>文章分享了我的技能中的前端技能和Java技能,今天继续跟大家分享的就是后端技能了. 我的技能树 我当前的技能树: 其中,标注为黄色旗帜的是基本掌握,标注为红色旗 ...

  8. Shell编程(week4_day2)--技术流ken

    本节内容 1. shell变量简介 2. 定义变量 3. 使用变量 4. 修改变量的值 5. 单引号和双引号的区别 6. 将命令的结果赋值给变量 7. 删除变量 8. 变量类型 9. 特殊变量列表 1 ...

  9. 在windows中创建.gitignore文件

    1.先任意创建一个文件,例如:1.txt 2.打开cmd命令行窗口,到1.txt目录下 windows7/8输入ren 1.txt .gitignore修改成功 windows10输入mv 1.txt ...

  10. Haskell复习笔记(二)

    Haskell中的递归 递归就是定义函数以调用自身的方式,关于递归解决问题的实例有很多,如斐波那契数列,还有汉诺塔问题,递归也正是Haskell中用来解决循环问题的关键. 自定义maxinum函数 m ...