Supervisor 、Supervisord-Monitor 的web统一管理安装、配置、使用

简介: Supervisor 安装、配置、使用、web管理,linux下进程管理系统、监听、重启、停止进程。

Supervisor: A Process Control System

说明:[http://supervisord.org/]Supervisor is a client/server system that allows its users to monitor and control a number of processes on UNIX-like operating systems.

Supervisor使用python开发的一个c/s服务,linux下进程管理系统、监听、重启、停止进程。Server supervisord,supervisorctl作为客户端管理进程。


一、  安装

1、yum 安装: yum install supervisor

2、easy_install 安装:wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py -O |python && easy_install supervisor

3、salt stack安装:

15d76b260f4fb283518c976de91f79c296be524a


init.sls

{% if grains['osmajorrelease'] == "6" %}

supervisor_install:

cmd.run:

- name: yum install python python-meld3 -y && rpm -Uvh http://****/supervisor-3.0-1.gf.el6.noarch.rpm

{% elif grains['osmajorrelease'] == "7" %}

supervisor:

pkg:

- installed

{% endif %}

/etc/supervisord.d/:

file.directory:

- makedirs: True

- mode: 755

/etc/supervisord.conf:

file.managed:

- source: salt://supervisord/files/supervisord.conf

- backup: minion

- template: jinja

/etc/supervisord.d/templet.ini:

file.managed:

- source: salt://supervisord/files/templet.ini

supervisord:

service.running:

- watch:

- file: /etc/supervisord.conf

- reload: True

- enable: True


salt安装:salt “*” state.sls supervisord

supervisor安装完成后,会生成supervisord(supervisor守护进程)、supervisorctl(客户端)、echo_supervisord_conf(生成配置文件),


二、  配置文件

cat /etc/supervisord.conf

[unix_http_server]

file=/var/tmp/supervisor.sock ;socket 文件,supervisorctl 会使用

[inet_http_server]

port=ip:9001 ;Web管理后台运行的IP和端口,建议监听内网ip

[supervisord]

logfile=/var/log/supervisor/supervisord.log

logfile_maxbytes=50MB ;日志文件大小,超出会rotate,默认 50MB,如果设成0,表示不限制大小

logfile_backups=10 ;日志文件保留备份数量默认10,设为0表示不备份

loglevel=info

pidfile=/var/run/supervisord.pid

nodaemon=false

minfds=1024

minprocs=200

[rpcinterface:supervisor]

supervisor.rpcinterface_factory

[supervisorctl]

serverurl=http://ip:9001

[include]

files = supervisord.d/*.ini

cat /etc/supervisord.d/templet.ini (进程模版,来自saltstack)

;[program:templet]

;command=/www/webcode/templet/bin/catalina.sh run

;user=appuser

;autostart=true

;autorestart=true

;startretries=3

;stopsignal=QUIT

;stopasgroup=true

;killasgroup=true

;stdout_logfile=/www/webcode/templet/logs/catalina.out

;redirect_stderr=true

;environment=JAVA_HOME=/opt/java

;stdout_capture_maxbytes=1024MB

;stdout_events_enabled=true

具体见:http://supervisord.org/configuration.html


三、 启动supervisor:

supervisord -c /etc/supervisord.conf

systemctl start supervisord

/etc/init.d/supervisord start

四、  supervisorctl使用

通过supervisorctl对进程进行管理:

supervisorctl help

79c8c6ee8678534f49278ea48d5b135f1709abcf

五、  Web管理:地址见配置文件

http://localip:9001,可以进行进程的重启,日志查看等操作

a1950a0876fe5f272679317f80ba6c23df6aa35d

六、  多主机统一管理:

官方推荐:http://supervisord.org/plugins.html

cesiWeb-based dashboard written in Python.

Django-DashvisorWeb-based dashboard written in Python. Requires Django 1.3 or 1.4.

NodervisorWeb-based dashboard written in Node.js.

Supervisord-MonitorWeb-based dashboard written in PHP.

SupervisorUIAnother Web-based dashboard written in PHP.

supervisorclusterctlCommand line tool for controlling multiple Supervisor instances using Ansible.

suponoffWeb-based dashboard written in Python 3. Requires Django 1.7 or later.

SupvisorsDesigned for distributed applications, written in Python 2.7. Includes an extended XML-RPC API and a Web-based dashboard.

目前我们自己使用Supervisord-Monitor,可以通过dash来管理不同服务器上Supervisord程,重启、停止、日志看等。具体截如下:

dcc8415773c3fb0137998fe1f80f389b6dfa9be5

相关实践学习
日志服务之使用Nginx模式采集日志
本文介绍如何通过日志服务控制台创建Nginx模式的Logtail配置快速采集Nginx日志并进行多维度分析。
目录
相关文章
|
1月前
|
Java 数据库连接 开发工具
web后端-SpringCloud-Config分布配置
web后端-SpringCloud-Config分布配置
|
3月前
|
移动开发 Java HTML5
Springboot web静态资源配置
Springboot web静态资源配置
50 0
|
30天前
|
数据库
最全三大框架整合(使用映射)——struts.xml和web.xml配置
最全三大框架整合(使用映射)——数据库资源文件jdbc.properties
9 0
|
1月前
|
SQL 安全 测试技术
如何在 Python 中进行 Web 应用程序的安全性管理,例如防止 SQL 注入?
如何在 Python 中进行 Web 应用程序的安全性管理,例如防止 SQL 注入?
15 0
|
1月前
|
安全 搜索推荐 前端开发
如何在本地安装Flask并将其web界面发布到公网上远程访问协同开发
如何在本地安装Flask并将其web界面发布到公网上远程访问协同开发
|
1月前
|
Java 关系型数据库 应用服务中间件
JAVA Web项目开发eclipse工具包配置(第一天)
JAVA Web项目开发eclipse工具包配置(第一天)
|
1月前
|
搜索推荐 Java 数据库
springboot基于Web的社区医院管理服务系统
springboot基于Web的社区医院管理服务系统
|
1月前
|
安全 应用服务中间件 nginx
|
2月前
|
SQL 监控 Java
Java Web应用中数据库连接池的配置与优化
Java Web应用中数据库连接池的配置与优化
|
3月前
|
搜索推荐 应用服务中间件 Apache
HTTP状态码301(永久重定向)不同Web服务器的配置方法
当用户或搜索引擎向服务器发出浏览请求时,服务器返回的HTTP数据流中头信息(header)中包含状态码301,以向用户表示该资源已经永久改变了位置。
84 2

热门文章

最新文章