1.安装

宿主机环境:(Centos7)

宿主机环境
#yum install python-setuptools

yum install python-setuptools
#easy_install supervisor

easy_install supervisor

测试安装是否成功:

#echo_supervisord_conf

echo_supervisord_conf

2.创建配置文件

创建supervisor配置文件目录/etc/supervisor/

#mkdir -m 755 -p /etc/supervisor/

mkdir -m 755 -p /etc/supervisor/

创建主配文件supervisord.conf

#echo_supervisord_conf > /etc/supervisor/supervisord.conf

echo_supervisord_conf > /etc/supervisor/supervisord.conf

创建项目配置文件目录

# mkdir -m 755 conf.d

# mkdir -m 755 conf.d

3.调试

在/home/k1ic/supervisor_simple 目录下创建test.c

test.c

编译为test

#gcc -o test test.c

gcc -o test test.c

在/etc/supervisor/conf.d 目录下创建 test.ini

test.ini

在主配文档中引入test.ini

files = ./conf.d/*.ini

启动supervisor

# supervisord -c /etc/supervisor/supervisord.conf

supervisord -c /etc/supervisor/supervisord.conf

pstree -p | grep supervisord

查看supervisord.log发现program test已启动

# cat /tmp/supervisord.log

# cat /tmp/supervisord.log

用 supervisorctl 查看已经被监控的program(注:直接用 #supervisorctl 会提示:http://localhost:9001 refused connection

#supervisorctl -c /etc/supervisor/supervisord.conf

supervisorctl -c /etc/supervisor/supervisord.conf

增加一例监控php脚本

创建skud.ini

skud.ini

[program:skuld]

在/home/k1ic/supervisor_simple目录下创建skuld.php

skuld.php

重启监控服务

reload

pstree

================分割线================

这才是重点^^

0. supervisor 比较适合监控业务应用,且只能监控前台程序,php fork方式实现的daemon不能用它监控,否则supervisor> status 会提示:BACKOFF  Exited too quickly (process log may have details)

BACKOFF  Exited too quickly (process log may have details)

cat supervisord.log

1.每次修改配置文件后需进入supervisorctl,执行reload, 改动部分才能生效

reload

2.两个命令

supervisord : supervisor的服务器端部分,用于supervisor启动

supervisorctl:启动supervisor的命令行窗口,在该命令行中可执行start、stop、status、reload等操作。

3.web管理界面

将supervisord.conf中[inet_http_server]部分做相应配置,在supervisorctl中reload即可启动web管理界面

[inet_http_server]

http://107.170.249.52:9001/?message=Page%20refreshed%20at%20Tue%20Sep%2029%2016%3A20%3A40%202015

参考文献:

Supervisor的安装与使用入门

http://fukun.org/archives/07102224.html

按需讲解之Supervisor

http://www.cnblogs.com/yjf512/archive/2012/03/05/2380496.html

supervisord entered FATAL state, too many start retries too quickly错误处理

http://beginman.cn/linux/2015/09/25/error-about-supervisord/

Supervisor监控PHP进程

http://www.phpddt.com/php/supervisor.html

关于进程监控及自动启动

http://www.vimer.cn/2013/07/%E5%85%B3%E4%BA%8E%E8%BF%9B%E7%A8%8B%E7%9B%91%E6%8E%A7%E5%8F%8A%E8%87%AA%E5%8A%A8%E5%90%AF%E5%8A%A8.html

Supervisor学习

http://beginman.cn/linux/2015/04/06/Supervisor/

通过进程模型进行扩展

http://12factor.net/zh_cn/concurrency

文/k1ic(简书作者)
原文链接:http://www.jianshu.com/p/9abffc905645
著作权归作者所有,转载请联系作者获得授权,并标注“简书作者”。

【转】supervisor安装与配置的更多相关文章

  1. Supervisor 安装与配置

    Supervisor是一个进程监控程序. 满足的需求是:我现在有一个进程需要每时每刻不断的跑,但是这个进程又有可能由于各种原因有可能中断.当进程中断的时候我希望能自动重新启动它,此时,我就需要使用到了 ...

  2. supervisor安装和配置

    直接命令 easy_install supervisor 如果报错先安装 yum install python-setuptools,再上面一条命令: 安装成功后显示finished,我们再次进行py ...

  3. Supervisor安装与配置(Linux/Unix进程管理工具)

    原文链接:http://blog.csdn.net/xyang81/article/details/51555473 Supervisor(http://supervisord.org/)是用Pyth ...

  4. supervisor安装及其配置

    一.supervisor概述 supervisor是一个c/s系统,被用来在类Unix系统中监控进程状态.supervisor使用python开发. 服务端进程为supervisord,主要负责启动自 ...

  5. Supervisor安装与配置

    Supervisor(http://supervisord.org/)是用Python开发的一个client/server服务,是Linux/Unix系统下的一个进程管理工具,不支持Windows系统 ...

  6. CentOS7下Supervisor安装与配置

    Supervisor(http://supervisord.org/)是用Python开发的一个client/server服务,是Linux/Unix系统下的一个进程管理工具,不支持Windows系统 ...

  7. supervisor 安装、配置、常用命令

    前言 在 web 应用部署到线上后,需要保证应用一直处于运行状态,在遇到程序异常.报错等情况,导致 web 应用终止时,需要保证程序可以立刻重启,继续提供服务. 所以,就需要一个工具,时刻监控 web ...

  8. Supervisor安装、配置、开启启动

    1.安装Python包管理工具(easy_install) wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py -O - ...

  9. supervisor安装、配置和运行

    supervisor是python写的进程管理工具,supervisor能够批量对进程执行启动,停止,重启等操作,有效提高了运维效率.注意supervisor只能管理前台进程,supervisor会自 ...

随机推荐

  1. 如何查看oracle数据库告警日志

    目标:查看alert日志 su - oracle cd $ORACLE_BASE/diag/rdbms/LXY/LXY/trace tail -100f alert_LXY.log 我的ORACLE_ ...

  2. Linux经典书籍推荐

    入门篇 <LINUX权威指南>书不错,写的很全面也比较广,涉及的不深,做为入门书籍不错,可以比较全面的了解linux .另外比较热门的也可以看看<鸟哥的私房菜>等书,偏管理类的 ...

  3. 玩转单元测试之DBUnit

    DBunit 是一种扩展于JUnit的数据库驱动测试框架,它使数据库在测试过程之间处于一种已知状态,如果一个测试用例对数据库造成了破坏性影响,它可以帮助避免造成后面的测试失败或者给出错误结果. 虽然不 ...

  4. java事件监听

    获取事件监听需要获取实现ActionListener接口的方法, public class SimpleEvent extends JFrame{    private JButton jb=new ...

  5. UNIX网络编程-基本API介绍(一)

    1.基本结构 大多数套接口函数都需要一个指向套接口地址结构的指针作为参数.每个协议族都定义它自己的套接口地址结构.这些结构的名字均以“sockaddr_”开头,并以对应每个协议族的唯一后缀结束. 1. ...

  6. 27. Best Time to Buy and Sell Stock && Best Time to Buy and Sell Stock II && Best Time to Buy and Sell Stock III

    Best Time to Buy and Sell Stock (onlineJudge: https://oj.leetcode.com/problems/best-time-to-buy-and- ...

  7. 33. Minimum Depth of Binary Tree && Balanced Binary Tree && Maximum Depth of Binary Tree

    Minimum Depth of Binary Tree OJ: https://oj.leetcode.com/problems/minimum-depth-of-binary-tree/ Give ...

  8. java中的类型比较

    Java 里的既可以比较基本类型也可以比较引用类型. 对于基本类型,Java 的==比较值比较 对于引用类型,Java 的==比较了引用的是否为同一个对象(比较内存地址), 也就是说这两个变量是否都指 ...

  9. innobackupex的安装

    innobackupex的安装方法有3种: 通过RPM包安装: 通过源码包安装: 通过二进制包安装. 第3种方法最简单,这里只介绍它.以下是安装步骤: 打开官方下载链接: Version默认是最新版本 ...

  10. java如何得到GET和POST请求URL和参数列表(转)

    在servlet中GET请求可以通过HttpServletRequest的getRequestURL方法和getQueryString()得到完整的请求路径和请求所有参数列表,POST的需要getPa ...