安装supervisord
一:简介
supervisord是一个进程管理工具,提供web页面管理,能对进程进行自动重启等操作。
优点:
- 可以将非后台运行程序后台运行
- 自动监控,重启进程
缺点:
- 不能管理后台运行程序
- 对多进程服务,不能使用kill关闭
二:安装supervisord
1.pip安装supervisord
pip install supervisor
2.生成配置文件
echo_supervisord_conf > /etc/supervisord.conf
如果报错:
vim /usr/lib/python2.6/site-packages/supervisor-3.3.3-py2.6.egg-info/requires.txt
# 注销如下内容即可
#meld3 >= 0.6.5
3.修改配置文件
[unix_http_server]
file=/tmp/supervisor.sock ; the path to the socket file
# 开启web界面
[inet_http_server] ; inet (TCP) server disabled by default
port=mweb07:9001 ; ip_address:port specifier, *:port for all iface
username=admin ; default is no username (open server)
password=123456 ; default is no password (open server)
[supervisord]
logfile=/tmp/supervisord.log ; main log file; default $CWD/supervisord.log
logfile_maxbytes=50MB ; max main logfile bytes b4 rotation; default 50MB
logfile_backups=10 ; # of main logfile backups; 0 means none, default 10
loglevel=info ; log level; default info; others: debug,warn,trace
pidfile=/tmp/supervisord.pid ; supervisord pidfile; default supervisord.pid
nodaemon=false ; start in foreground if true; default false
minfds=1024 ; min. avail startup file descriptors; default 1024
minprocs=200 ; min. avail process descriptors;default 200
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
[program:elasticsearch]
command=/data/elk/elasticsearch/bin/elasticsearch ; 管理命令,supervisor不支持后太进程
process_name=%(program_name)s
user=elk ;进程启动用户
autostart=true ;是否随supervisor启动
autorestart=true ;是否在挂了之后重启,意外关闭后会重启,比如kill掉!
startretries=3 ;启动尝试次数
stderr_logfile=/tmp/tail1.err.log ;标准输出的位置
stdout_logfile=/tmp/tail1.out.log ;标准错误输出的位置
loglevel=info ;日志的级别
[program:redis]
command=/data/elk/redis/src/redis-server /data/elk/redis/redis.conf
process_name=%(program_name)s
user=elk
directory=/data/elk/redi
4.启动关闭
启动:
supervisord -c /etc/supervisord.conf
关闭:
supervisorctl shutdown
管理命令:
supervisorctl stop program_name # 停止某一个进程,program_name 为 [program:x] 里的 x
supervisorctl start program_name # 启动某个进程
supervisorctl restart program_name # 重启某个进程
supervisorctl stop groupworker: # 结束所有属于名为 groupworker 这个分组的进程 (start,restart 同理)
supervisorctl stop groupworker:name1 # 结束 groupworker:name1 这个进程 (start,restart 同理)
supervisorctl stop all # 停止全部进程,注:start、restartUnlinking stale socket /tmp/supervisor.sock
、stop 都不会载入最新的配置文件
supervisorctl reload # 载入最新的配置文件,停止原有进程并按新的配置启动、管理所有进程
supervisorctl update # 根据最新的配置文件,启动新配置或有改动的进程,配置没有改动的进程不会受影响而重启
5.效果展示
三:安装supervisord-monitor
- supervisord-monitor是对supervisord的一个集中化管理工具,可以对supervisor统一化操作
1.安装
# 下载
git clone https://github.com/mlazarov/supervisord-monitor.git
# 生成配置文件
cd supervisord-monitor/
cp application/config/supervisor.php.example application/config/supervisor.php
2.修改配置文件,添加supervisord主机
mweb08 展示名 url 服务器地址 port 端口
$config['supervisor_servers'] = array(
'mweb08' => array(
'url' => 'http://mweb08/RPC2',
'port' => '9001',
'username' => 'admin',
'password' => '123456'
),
'mweb07' => array(
'url' => 'http://mweb07/RPC2',
'port' => '9001',
'username' => 'admin',
'password' => '123456'
),
);
3.添加nginx对supervisord-monitor的支持
server {
listen 82;
server_name localhost;
set $web_root /data/web/supervisord-monitor/public_html;
root $web_root;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $web_root$fastcgi_script_name;
fastcgi_param SCHEME $scheme;
}
}
5.展示,重启nginx后,访问即可
安装supervisord的更多相关文章
- Centos7.x 安装 Supervisord
[环境] 系统:Centos 7.3 软件:supervisord [安装Supervisord] yum install epel-release yum install -y supervisor ...
- Supervisord安装和配置
http://zhangweide.cn/archive/2013/supervisor-note.html Supervisord supervisord的出现,结束了我这苦恼的问题,它可以帮你守护 ...
- 用Supervisord管理Python进程
http://feilong.me/2011/03/monitor-processes-with-supervisord Supervisord是用Python实现的一款非常实用的进程管理工具,类似于 ...
- supervisor安装和配置
直接命令 easy_install supervisor 如果报错先安装 yum install python-setuptools,再上面一条命令: 安装成功后显示finished,我们再次进行py ...
- [linux]执行pip安装的程序:command not found
执行pip安装的程序:command not found 问题描述: 我有一台阿里云服务器,上面装的是centos系统,我用pip安装好vituralenv,都没办法直接启动.同样 我今天在部署我的t ...
- CentOS 6.X x64 编译安装 Countly
CentOS 6.X x64 编译安装Countly 安装所需的软件 yum -y install supervisor ImageMagick sendmail 1. 安装 node.js wge ...
- Linux supervisord配置使用
supervisor官方网站 http://supervisord.org 1.安装supervisord Ubuntu: $sudo apt-get install python-setuptool ...
- Supervisord管理进程实践
今天凑空研究了下Supervisord,这是一款linux进程管理工具,使用python开发,主要用于在后台维护进程(类似master守护进程),可以实现监控进程的状态.自动重启进程等操作,便于一些服 ...
- Ubuntu安装Gogs服务
花了半天的时间把阿里云的centos 换成了ubuntu 14.04 lts ,原因是因为我想安装个gogs git服务,但是centos的glibc版本太低,折腾了半天没有成功. 迁移Ghost数据 ...
随机推荐
- 简易RPC框架-熔断降级机制
*:first-child { margin-top: 0 !important; } body > *:last-child { margin-bottom: 0 !important; } ...
- Thinkphp导入外部类的方法
相信很多人在使用TP时候都苦恼使用外部类各种不成功 下面为大家详细介绍下引用方法和注意细节 手动加载第三方类库 由于第三发类库没有具体的命名空间,所以需要使用以下几种方法手动导入 1.import方法 ...
- Linux 链接详解(2)
可执行文件加载执行过程: 上一节我们说到ELF文件格式,静态库的符号解析和重定位的内容.这一节我们来分析一下可执行文件. 由上一节我们知道可执行文件也是ELF文件,当程序被加载器加载到内存时是按照EL ...
- centos 使用 beyond compare 对比工具
我这里的环境是centos7桌面版 三条命令安装beyond compare wget http://www.scootersoftware.com/bcompare-4.2.3.22587.x86_ ...
- win10下Python3.6安装、配置以及pip安装包教程
0.目录 1.前言 2.安装python 3.使用pip下载.安装包 3.1 安装Scrapy 3.2 安装PyQt 3.3 同时安装多个包 3.4 pip的常用命令 1.前言 之前在电脑上安装了py ...
- Android崩溃提示 “EGL_BAD_CONFIG"
这两天将之前提到的一个室内定位程序的ArcGIS的SDK从10.2.8迁移到100.1.0. 期间反复出现奇怪的问题,最终定位到这个问题: java.lang.RuntimeException: cr ...
- 小随笔:利用Shader实现模型爆炸和沙粒化的效果
0x00 前言 上一篇小随笔<小随笔:利用Shader给斯坦福兔子长毛和实现雪地效果>中,我和大家聊了聊著名的斯坦福兔子和利用geometry shader实现的一些效果.这篇文章继续沿用 ...
- BFS+数据处理 Under the Trees UVa
题意:将多叉树转化为括号表示法,每个非叶结点的正下方都有一个'|'然后下方是一排'-'和字符,恰好覆盖所有子结点的正上方,单独的一行'#'为数据的结束标志 解题思路:用gets将字符数组输入,本题不用 ...
- html Embed用法 页面播放视频
一句话概括所有问题.查资料说在页面播放视频都是一些插件 刚发现一个Html自带的标签 很吊的样子 <div > <embed src="${compla ...
- 运行期以索引获取tuple元素-C++14
在编译期很容易根据索引来获取对应位置的元素,因为 tuple 的帮助函数 std::get<N>(tp) 就能获取 tuple 中第 N 个元素.然而我们却不能直接在运行期通过变量来获取 ...