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. 2018-7-27银行卡bin大全-根据银行卡开头查银行

    支付宝卡号验证工具 https://ccdcapi.alipay.com/validateAndCacheCardInfo.json?_input_charset=utf-8&cardNo=银 ...

  2. SmartSql 类型处理器

    Nuget 安装 Install-Package SmartSql.TypeHandler -Version 3.0.1 SmartSql.TypeHandler 包括了俩种类型的类型处理程序: Js ...

  3. 在.NET Core中使用简单的插件化机制

    前言 插件化,其实也并不是什么新东西了,像nopCommerce等开源项目都有类似的机制,而且功能比较完善和齐全. 相信大家都对接过不少支付方式,支付宝.微信以及各大银行或第三方的支付公司. 我们可以 ...

  4. eclipse 创建maven 项目 动态web工程完整示例 maven 整合springmvc整合mybatis

    接上一篇: eclipse 创建maven 项目 动态web工程完整示例 eclipse maven工程自动添加依赖设置 maven工程可以在线搜索依赖的jar包,还是非常方便的 但是有的时候可能还需 ...

  5. Perl进程:僵尸进程和孤儿进程

    概念 僵尸进程:当子进程退出时,父进程还没有(使用wait或waitpid)接收其退出状态时,子进程就成了僵尸进程 孤儿进程:当子进程还在运行时,父进程先退出了,子进程就会成为孤儿进程被pid=1的i ...

  6. 使用表类型(Table Type-SqlServer)实现百万级别的数据一次性毫秒级别插入

    使用表类型(Table Type)实现百万级别的数据一次性插入 思路 1 创建表类型(TaBleType)         2 创建添加存储过程         3 使用C#语言构建一个DataTab ...

  7. 谈下WebSocket介绍,与Socket的区别

    这个话题应该是面试中出现频率比较高的吧....不管咋样还是有必要深入了解下两者之间的关联.废话不多说,直接入题吧: WebSocket介绍与原理 目的:即时通讯,替代轮询 网站上的即时通讯是很常见的, ...

  8. 拯救老旧工程,记桥接SpringMVC与Stripes框架

    背景: 公司基础设施部门推出了自己的微服务框架(以下简称M),要求所有业务应用都要接入进去,但坑爹的是M只提供了SpringMVC工程的support,对于采用Stripes作为MVC框架的应用并不支 ...

  9. BOM简单知识

    JS分为ECMAScript,DOM,BOM BOM是用来和浏览器进行‘’对话‘’的 一:与window对象进行交互: 1.查看用户信息: window.navigator.userAgent; 可以 ...

  10. 20190322-a标签、img标签、三列表、特殊字符实体、表格

    目录 1.a标签 a标签的属性 锚点 2.img标签 img标签的属性 图像热区 3.三列表 有序列表(Ordered List)     ol>li 无序列表(Unordered List)  ...