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. .net core通过多路复用实现单服务百万级别RPS吞吐

    多路复用其实并不是什么新技术,它的作用是在一个通讯连接的基础上可以同时进行多个请求响应处理.对于网络通讯来其实不存在这一说法,因为网络层面只负责数据传输:由于上层应用协议的制订问题,导致了很多传统服务 ...

  2. EF架构~mysql中时间戳字段被认为是主键自增

    回到目录 如果在mysql中添加了自增字段,用来维护行的版本,那么在EF中会有一个问题,会把它当成是数据表主键,当你的真正主键是自曾时,就会把默认值0拼到生成的SQL语句里,导致你的insert出错, ...

  3. 产品研发团队如何融合OKR与Scrum敏捷开发?

    「 OKR 」现在非常的火爆,很多公司都在使用,不仅国外的 Google.英特尔等大公司在用,国内的一线知名互联网企业今日头条和一些创业团队也都在使用. 那为什么「 OKR 」这么受欢迎呢,因为把它可 ...

  4. 深度学习(九) 深度学习最全优化方法总结比较(SGD,Momentum,Nesterov Momentum,Adagrad,Adadelta,RMSprop,Adam)

    前言 这里讨论的优化问题指的是,给定目标函数f(x),我们需要找到一组参数x(权重),使得f(x)的值最小. 本文以下内容假设读者已经了解机器学习基本知识,和梯度下降的原理. SGD SGD指stoc ...

  5. leetcode — binary-tree-level-order-traversal

    import org.lep.leetcode.binarytreeinordertraversal.BinaryTreeInOrderTraversal; import java.util.Arra ...

  6. Spring基础系列-参数校验

    原创作品,可以转载,但是请标注出处地址:https://www.cnblogs.com/V1haoge/p/9953744.html Spring中使用参数校验 概述 ​ JSR 303中提出了Bea ...

  7. C#如何生成缩略图、水印

    1.安装CodeCarvings.Piczard   Install-Package CodeCarvings.Piczard 2.生成缩略图 ImageProcessingJob jobThumb ...

  8. 点击checkbox后,$(this).attr('checked')得到的值不会发生改变

    这两天遇到一个问题,就是在点击checkbox后,$(this).attr('checked')得到的值要么是undefined,要么是checked,同一个表单一直点击却一点都不会发生改变,调试了一 ...

  9. 控制台程序(C#)不弹出认证窗口连接到Dynamics CRM Online的Web API

    摘要: 本人微信和易信公众号: 微软动态CRM专家罗勇 ,回复271或者20180602可方便获取本文,同时可以在第一间得到我发布的最新的博文信息,follow me!我的网站是 www.luoyon ...

  10. Easyui 修改|新增jquery-easyui icon图标

    修改|新增jquery-easyui icon图标 by:授客 QQ:1033553122 测试环境 jquery-easyui-1.5.3 修改配置文件 打开jquery-easyui-1.5.3\ ...