Supervisor是用Python开发的一套通用的进程管理程序,能将一个普通的命令行进程变为后台daemon,并监控进程状态,异常退出时能自动 重启。它是通过fork/exec的方式把这些被管理的进程当作supervisor的子进程来启动,这样只要在supervisor的配置文件中,把要 管理的进程的可执行文件的路径写进去即可。也实现当子进程挂掉的时候,父进程可以准确获取子进程挂掉的信息的,可以选择是否自己启动和报警

安装:

Supervisor是python2写就的一款强大的运维工具(其实现在已经支持Python3了 https://github.com/Supervisor/supervisor)

那么怎么利用Supervisor监控python3程序呢

通过指令:pip3 install git+https://github.com/Supervisor/supervisor

配置文件:

# supervisor名字
[program: your_supervisor_name] #supervisor执行命令
command = uwsgi --init your_uwsgi.ini #项目目录
derectory = ...... #开始的时候等待多少秒
startsecs = 0 #停止时等待多少秒
stopawitsecs = 0 #自动开始
autorestart = true #程序挂了是否重启
autorestart = true #输出的log文件
stdout_logfile = .../log/supervisor.log #输出的错误文件
stderr_logfile = .../log/supervisor.err #把 stderr 重定向到 stdout,默认 false
redirect_stderr = true #stdout 日志文件大小,默认 50MB
stdout_logfile_maxbytes = 20M [supervisor]
# log 级别
loglevel = info

启动指令:

supervisord -c mycms_supervisor.conf

安装supervisor时,默认安装supervisord 和 supervisorctl

supervisorctl 相当于一个客户端,去管理supervisord 的进程


配置:

#使用supervisorctl配置

[inet_http_server]
#supervisor服务器
port = :9001
username = admin
password = 123 [supervisorctl]
#使用supervisorctl的登录地址和端口号
serverurl = http://127.0.0.1:9001 #登录supervisorctl的用户名和密码
username = admin
password = 123 #不定义命名空间
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

操作指令

supervisorctl 全局进入

进入单个 进程 supervisorctl -c supervisor.conf

status #查看状态

start programe_name #启动程序

restart programe_name #重启程序

stop programe_name #关闭程序

reload #重新加载配置文件

quit #退出控制台

supervisor 官网

supervisor 管理uwsgi 进程的更多相关文章

  1. 使用Supervisor管理Linux进程

    使用Supervisor管理Linux进程 简介 Supervisor是一个C/S系统,它可以在类UNIX系统上控制系统进程,由python编写,提供了大量的功能来实现对进程的管理. 安装 sudo ...

  2. celery和supervisor配合使用,实现supervisor管理celery进程

    在这里我选择redis作为celery异步任务的中间人,系统选择CentOS6.5 64位.redis.celery和supervisor的安装参见官方文档. 安装完毕后: 1, 创建celery的实 ...

  3. supervisor管理uwsgi

    1. 前言 传统的管理uwsgi服务: 1. 通过shell脚本来编写start restart stop函数来控制 2. 比较麻烦,有时候控制写的烂,还会出现意想不到的错误 supervisor进行 ...

  4. ubuntu supervisor管理uwsgi+nginx

    一.概述 superviosr是一个Linux/Unix系统上的进程监控工具,他/她upervisor是一个Python开发的通用的进程管理程序,可以管理和监控Linux上面的进程,能将一个普通的命令 ...

  5. 使用Supervisor管理Celery进程。

    讲过一篇celery的,但是celery启动后并不是daemon的,在生产环境中这肯定是不可以的,那怎么办呢? 这就需要使用supervisor进行进程管理了,下面详细介绍. 一. superviso ...

  6. supervisor管理ELK进程

    1.配置supervisor #更新epel yum install epel-release yum install python-pip pip install supervisor -p /et ...

  7. supervisor管理进程工具配置

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

  8. Supervisor 管理进程,Cloud Insight 监控进程,完美!

    Supervisor 是由 Python 语言编写.基于 linux 操作系统的一款服务器管理工具,用于监控服务器的运行,发现问题能立即自动预警及自动重启等. Cloud Insight 是一款次世代 ...

  9. supervisor管理进程 superlance对进程状态报警

    supervisor介绍 首先,介绍一下supervisor.Supervisor(http://supervisord.org/)是用Python开发的一个client/server服务,是Linu ...

随机推荐

  1. 证明解析函数u=c1 与 v=c2 正交

    方程u(x,y)=c1对应平面上的曲线, 求导dy/dx=  -ux/uy   类似有v曲线的dy/dx=-vx/vy   两者相乘,使用柯西-黎曼方程结果是-1 表示在相交点两者的切线互相垂直. 另 ...

  2. pageshow和pagehide事件

    Firefox和opera有一个特性,往返缓存:可以在用户使用浏览器的后退和前进按钮时加快页面的转换速度,这个缓存不仅保存了页面的数据,还有DOM和JavaScript的状态. 为了更形象的说明bfc ...

  3. python 基础_字符串9

    凡是重要的# 字符串的创建,字符串可以是单引号创建也可以是双引号创建 str1 = 'hello world' #当你要输出的是单引号的时候,你括起字符串的必须是双引号.当你输出的是双引号的时候,你括 ...

  4. WordPaster-CuteEditor6.7整合教程

    CuteEditor6.7下载地址:http://yunpan.cn/QzvjC5iaH5HJm 1.添加CuteEditor.dll的引用 2.在编辑器页面,为编辑器工具栏增加控件按钮 3.在前台增 ...

  5. css3动画特效集合

    <!DOCTYPE html> <html> <head> <title></title> <meta charset="u ...

  6. Ng第四课:多变量线性回归(Linear Regression with Multiple Variables)

    4.1  多维特征 4.2  多变量梯度下降 4.3  梯度下降法实践 1-特征缩放 4.4  梯度下降法实践 2-学习率 4.5  特征和多项式回归 4.6  正规方程 4.7  正规方程及不可逆性 ...

  7. (转).net面试题(老赵)

    转自:http://www.cnblogs.com/chenxiaoran/archive/2012/05/27/2519988.html 1.什么是CLR 公共语言运行时(Comman langua ...

  8. 终端简单使用 &vim编写代码

    vim简单实用 & 用vim编写代码 ##  简单介绍  ## vi 1.c 建立1.c(文件存在,则打开1.c) vi共有三种模式: 按esc进入指令模式 按i进入编辑模式(按i光标位置不变 ...

  9. PAT甲级 1122. Hamiltonian Cycle (25)

    1122. Hamiltonian Cycle (25) 时间限制 300 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue The ...

  10. shell工具-cut

    cut cut的工作就是“剪”,具体说就是在文件中负责剪切数据用的.cut命令从文件的每一行剪切字节.字符.和字段并将这些字节.字符和字段输出 基本用法 cut [参数] filename # 说明: ...