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. JavaScript中Math--random()/floor()/round()/ceil()

    Math.random():返回0-1之间的任意数,不包括0和1: Math.floor(num):返回小于等于num的整数,相当于四舍五入的四舍,不五入:例子:Math.floor(1.0);Mat ...

  2. git branch几个简单操作

    1.git branch  该命令会列出当先项目中的所有分支信息,其中以*开头的表示当前所在的分支.参数-r列出远程仓库中的分支,而-a则远程与本地仓库的全部分支. 2.git branch deve ...

  3. Linux学习笔记(一)

    1.正则表达式 \w 匹配任何字类字符,包括下划线.与“[A-Za-z0-9_]”等效. \W 与任何非单词字符匹配.与“[^A-Za-z0-9_]”等效. +    一次或多次匹配前面的字符或子表达 ...

  4. python 向上取整ceil 向下取整floor 四舍五入round

    #encoding:utf-8 import math #向上取整 http://www.manongjc.com/article/1335.html print "math.ceil--- ...

  5. CENTOS 6.4 安装oracle 10g,手工建库及升级到10.2.0.5

    一. 数据库软件安装 参照官方手册 1.安装rpm包 注这里的yum直接用163的yum yum -y install binutils compat-libstdc++-33 compat-libs ...

  6. python序列化: json & pickle & shelve 模块

    一.json & pickle & shelve 模块 json,用于字符串 和 python数据类型间进行转换pickle,用于python特有的类型 和 python的数据类型间进 ...

  7. Ms sql将首字母大写

    --辅助表 create table a ( a int ) declare @b int begin insert into a values(@b) end; go --表数据 ),id int) ...

  8. 浅谈OpenGL变换矩阵

    OpenGL中使用的矩阵全为列向量为主的矩阵. 参考OpenGL变换网站为  http://www.songho.ca/opengl/gl_transform.html 1.什么是GL_MODELVI ...

  9. 关于对 maximio平台的五个常用类的初步理解及总结

    AppBean:绑定应用的默认Bean类,控制主对象集/单个对象,和ui关联的类 继承:DataBean DataBean:任何对象集/单个对象,在ui端处理类. 1.在对象层:写一个Fld类,调用构 ...

  10. http的应用httpurlconnection--------1

    http请求后获得所需要的是字符串的时候 URL url=new URL(strurl); try { HttpURLConnection conn=(HttpURLConnection) url.o ...