centos7安装supervisor详细教程_蘑菇猎手的博客-CSDN博客_centos 安装supervisor


本站和网页 https://blog.csdn.net/donggege214/article/details/80264811 的作者无关,不对其内容负责。快照谨为网络故障时之索引,不代表被搜索网站的即时页面。

centos7安装supervisor详细教程_蘑菇猎手的博客-CSDN博客_centos 安装supervisor
centos7安装supervisor详细教程
蘑菇猎手
于 2018-05-11 14:23:05 发布
69089
收藏
58
分类专栏:
运维
linux
文章标签:
supervisor
supervisord
supervisorctl
centos
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/donggege214/article/details/80264811
版权
运维
同时被 2 个专栏收录
10 篇文章
0 订阅
订阅专栏
linux
6 篇文章
0 订阅
订阅专栏
解释一些让人容易疑惑名词:
supervisor:要安装的软件的名称。 supervisord:装好supervisor软件后,supervisord用于启动supervisor服务。 supervisorctl:用于管理supervisor配置文件中program和supervisor服务本身。
方法一、使用yum命令安装(推荐)
$ sudo su - #切换为root用户
# yum install epel-release
# yum install -y supervisor
# systemctl enable supervisord # 开机自启动
# systemctl start supervisord # 启动supervisord服务
# systemctl status supervisord # 查看supervisord服务状态
# ps -ef|grep supervisord # 查看是否存在supervisord进程
方法二、使用pip手工安装配置(不推荐)
准备工作
确认9001端口未被占用,如果9001端口被占用,请将后面提到的supervisord.conf文件中的9001替换为可用端口号,如7001。
一、安装supervisor
切换为root用户
$ sudo su -
为python2.7安装pip(supervisor只支持python2.7) (1) 下载pip
# wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate
(2) 安装pip
# python2.7 get-pip.py
如果遇到psutil相关的报错,参考https://www.cnblogs.com/chentq/p/4954135.html
安装supervisor
# pip2 install supervisor
# #可能遇到的问题及解决办法:
# #如果遇到NameError: name 'sys_platform' is not defined
# #运行如下命令即可(但是也会报错,不用理会)
# #pip2 install --upgrade distribute,
# #然后再卸载supervisor,
# #pip2 uninstall supervisor,
# #重装supervisor,
# #pip2 install supervisor。
# #参考http://www.yuchaoshui.com/post/CentOS6-Python-installation
创建supervisor所需目录
# mkdir /etc/supervisord.d/
创建supervisor配置文件
# echo_supervisord_conf > /etc/supervisord.conf
编辑supervisord.conf文件
# vim /etc/supervisord.conf
文件内容如下(直接展示完整的文件内容,建议直接复制粘贴,如果想知道详细改动,可逐行对比)
; Sample supervisor config file.
; For more information on the config file, please see:
; http://supervisord.org/configuration.html
; Notes:
; - Shell expansion ("~" or "$HOME") is not supported. Environment
; variables can be expanded using this syntax: "%(ENV_HOME)s".
; - Quotes around values are not supported, except in the case of
; the environment= options as shown below.
; - Comments must have a leading space: "a=b ;comment" not "a=b;comment".
; - Command will be truncated if it looks like a config file comment, e.g.
; "command=bash -c 'foo ; bar'" will truncate to "command=bash -c 'foo ".
[unix_http_server]
file=/var/run/supervisor.sock ; the path to the socket file
;chmod=0700 ; socket file mode (default 0700)
;chown=nobody:nogroup ; socket file uid:gid owner
;username=user ; default is no username (open server)
;password=123 ; default is no password (open server)
[inet_http_server] ; inet (TCP) server disabled by default
port=127.0.0.1:9001 ; ip_address:port specifier, *:port for all iface
;username=user ; default is no username (open server)
;password=123 ; default is no password (open server)
[supervisord]
logfile=/var/log/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=/var/run/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
;umask=022 ; process file creation umask; default 022
;user=chrism ; default is current user, required if root
;identifier=supervisor ; supervisord identifier, default is 'supervisor'
;directory=/tmp ; default is not to cd during start
;nocleanup=true ; don't clean up tempfiles at start; default false
;childlogdir=/tmp ; 'AUTO' child log dir, default $TEMP
;environment=KEY="value" ; key value pairs to add to environment
;strip_ansi=false ; strip ansi escape codes in logs; def. false
; The rpcinterface:supervisor section must remain in the config file for
; RPC (supervisorctl/web interface) to work. Additional interfaces may be
; added by defining them in separate [rpcinterface:x] sections.
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
; The supervisorctl section configures how supervisorctl will connect to
; supervisord. configure it match the settings in either the unix_http_server
; or inet_http_server section.
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket
;username=chris ; should be same as in [*_http_server] if set
;password=123 ; should be same as in [*_http_server] if set
;prompt=mysupervisor ; cmd line prompt (default "supervisor")
;history_file=~/.sc_history ; use readline history if available
; The sample program section below shows all possible program subsection values.
; Create one or more 'real' program: sections to be able to control them under
; supervisor.
;[program:theprogramname]
;command=/bin/cat ; the program (relative uses PATH, can take args)
;process_name=%(program_name)s ; process_name expr (default %(program_name)s)
;numprocs=1 ; number of processes copies to start (def 1)
;directory=/tmp ; directory to cwd to before exec (def no cwd)
;umask=022 ; umask for process (default None)
;priority=999 ; the relative start priority (default 999)
;autostart=true ; start at supervisord start (default: true)
;startsecs=1 ; # of secs prog must stay up to be running (def. 1)
;startretries=3 ; max # of serial start failures when starting (default 3)
;autorestart=unexpected ; when to restart if exited after running (def: unexpected)
;exitcodes=0,2 ; 'expected' exit codes used with autorestart (default 0,2)
;stopsignal=QUIT ; signal used to kill process (default TERM)
;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10)
;stopasgroup=false ; send stop signal to the UNIX process group (default false)
;killasgroup=false ; SIGKILL the UNIX process group (def false)
;user=chrism ; setuid to this UNIX account to run the program
;redirect_stderr=true ; redirect proc stderr to stdout (default false)
;stdout_logfile=/a/path ; stdout log path, NONE for none; default AUTO
;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
;stdout_logfile_backups=10 ; # of stdout logfile backups (0 means none, default 10)
;stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0)
;stdout_events_enabled=false ; emit events on stdout writes (default false)
;stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO
;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
;stderr_logfile_backups=10 ; # of stderr logfile backups (0 means none, default 10)
;stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0)
;stderr_events_enabled=false ; emit events on stderr writes (default false)
;environment=A="1",B="2" ; process environment additions (def no adds)
;serverurl=AUTO ; override serverurl computation (childutils)
; The sample eventlistener section below shows all possible eventlistener
; subsection values. Create one or more 'real' eventlistener: sections to be
; able to handle event notifications sent by supervisord.
;[eventlistener:theeventlistenername]
;command=/bin/eventlistener ; the program (relative uses PATH, can take args)
;process_name=%(program_name)s ; process_name expr (default %(program_name)s)
;numprocs=1 ; number of processes copies to start (def 1)
;events=EVENT ; event notif. types to subscribe to (req'd)
;buffer_size=10 ; event buffer queue size (default 10)
;directory=/tmp ; directory to cwd to before exec (def no cwd)
;umask=022 ; umask for process (default None)
;priority=-1 ; the relative start priority (default -1)
;autostart=true ; start at supervisord start (default: true)
;startsecs=1 ; # of secs prog must stay up to be running (def. 1)
;startretries=3 ; max # of serial start failures when starting (default 3)
;autorestart=unexpected ; autorestart if exited after running (def: unexpected)
;exitcodes=0,2 ; 'expected' exit codes used with autorestart (default 0,2)
;stopsignal=QUIT ; signal used to kill process (default TERM)
;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10)
;stopasgroup=false ; send stop signal to the UNIX process group (default false)
;killasgroup=false ; SIGKILL the UNIX process group (def false)
;user=chrism ; setuid to this UNIX account to run the program
;redirect_stderr=false ; redirect_stderr=true is not allowed for eventlisteners
;stdout_logfile=/a/path ; stdout log path, NONE for none; default AUTO
;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
;stdout_logfile_backups=10 ; # of stdout logfile backups (0 means none, default 10)
;stdout_events_enabled=false ; emit events on stdout writes (default false)
;stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO
;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
;stderr_logfile_backups=10 ; # of stderr logfile backups (0 means none, default 10)
;stderr_events_enabled=false ; emit events on stderr writes (default false)
;environment=A="1",B="2" ; process environment additions
;serverurl=AUTO ; override serverurl computation (childutils)
; The sample group section below shows all possible group values. Create one
; or more 'real' group: sections to create "heterogeneous" process groups.
;[group:thegroupname]
;programs=progname1,progname2 ; each refers to 'x' in [program:x] definitions
;priority=999 ; the relative start priority (default 999)
; The [include] section can just contain the "files" setting. This
; setting can list multiple files (separated by whitespace or
; newlines). It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisord.d/*.ini
保存退出
Esc:x
启动supervisor
# supervisord -c /etc/supervisord.conf
查看supervisor是否启动成功
# ps -ef|grep supervisord
root 932 1 0 May10 ? 00:00:09 /bin/python2.7 /bin/supervisord -c /etc/supervisord.conf
root 7902 6814 0 10:29 pts/0 00:00:00 grep --color=auto supervisord
至此,安装supervisor就结束了
二、将supervisor配置为开机自启动服务
编辑服务文件
# vim /usr/lib/systemd/system/supervisord.service
内容如下
[Unit]
Description=Supervisor daemon
[Service]
Type=forking
PIDFile=/var/run/supervisord.pid
ExecStart=/bin/supervisord -c /etc/supervisord.conf
ExecStop=/bin/supervisorctl shutdown
ExecReload=/bin/supervisorctl reload
KillMode=process
Restart=on-failure
RestartSec=42s
[Install]
WantedBy=multi-user.target
保存退出
Esc:x
启动服务
# systemctl enable supervisord
查看是否启动
# systemctl is-enabled supervisord
enabled
成功之后,就可以使用如下命令管理supervisor服务了
# systemctl stop supervisord
# systemctl start supervisord
# systemctl status supervisord
# systemctl reload supervisord
# systemctl restart supervisord
至此,安装supervisor和配置为supervisor服务的工作就完成了。
补充:
因为我们的supervisor使用的是root安装,所以,对于非root用户,如果在执行
$ supervisord -c /etc/supervisord.conf
$ supervisorctl
命令时,会遇到访问被拒(Permission denied)的问题。 在命令最前面加上sudo即可 2. 如果更改了/etc/supervisord.conf中的端口号,原来的简写命令
# supervisorctl
就需要在后面指定supervsor配置文件位置,或指定supervisor服务运行的端口号
# supervisorctl -c /etc/supervisord.conf
# supervisorctl -s http://localhost:7001
否则会报连接拒绝
# supervisorctl
http://localhost:9001 refused connection
supervisor>
蘑菇猎手
关注
关注
20
点赞
58
收藏
打赏
评论
centos7安装supervisor详细教程
为centos7安装supervisor在ubuntu操作系统上可以使用apt install supervisor安装superivosr,并自动配置为服务(开机自动启动supervisor),但是在centos7上只能手动安装,所以教程分为两部分,安装supervisor,配置为系统服务。安装supervisor切换为root用户sudo su -为python2.7
复制链接
扫一扫
专栏目录
centos7 安装supervisor教程以及常见问题
01-20
原文作者:studytime
原文链接:https://www.studytime.xin/
目录
简介
Supervisor 是一个进程控制系统。它是一个 C/S 系统 (注意:其提供 WEB 接口给用户查询和控制)。它允许用户去监控和控制在类 UNIX 系统的进程。它的目标与 launchd、daemontools 和 runit 有些相似。但是与它们不一样的是、它不是作为 init (进程号 pid 是 1) 运行。它是被用来控制进程、并且它在启动的时候和一般程序并无二致。
作用
你的 Nginx,Tomcat,memcache,Redis… 会崩么?
那你自己写的服务器监测脚本呢?
centos安装supervisor
OfficerGoodbody的博客
09-02
111
简介
Supervisor是用Python开发的一套通用的进程管理程序,能将一个普通的命令行进程变为后台daemon,并监控进程状态,异常退出时能自动重启。
安装
yum install -y supervisor
实例
添加tomcat服务
vim /etc/supervisord.d/tomcat.ini
[program:tomcat...
评论 8
您还未登录,请先
登录
后发表或查看评论
记一次 Centos7 安装配置 supervisor
一花一世界
04-06
372
一、基本信息
二、环境准备
1、系统说明
系统:CentOS-7-x86_64-Minimal-1708
下载地址:
http://archive.kernel.org/centos-vault/7.4.1708/isos/x86_64/
2、VMware 版本:VMware Workstation Pro15
3、安装虚拟机
参考https://blog....
centos7下yum安装Supervisor
Jsonxiang的博客
02-22
5446
centos7下yum安装Supervisor
# yum install epel-release
# yum install -y supervisor
# systemctl enable supervisord # 开机自启动
# systemctl start supervisord # 启动supervisord服务
# systemctl status supervisord #...
Centos7 中使用Supervisor守护进程
最新发布
fangqingivu的专栏
11-02
27
supervisor 守护进程
Docker的详细使用
残影的博客
11-11
644
Docker的详细使用一、Docker概述1.Docker为什么会出现?二、Docker安装1.Docker的基本组成2. 安装Docker
一、Docker概述
1.Docker为什么会出现?
一款产品:开发-上线两套环境!应用环境,应用配置。
开发-运维。问题:我在我的电脑上可以运行!版本更新,导致服务不可用!对于运维来说,考验就十分大?环境配置是十分的麻烦,每一个机器都要部署环境(集群 Redis、ES、Hadoop)!费时费力。发布个项目(jr+( Redis MySQL jdk ES)),项目能
supervisor安装(一)
西卡卡的博客
09-03
291
一、supervisor简介
Supervisor是用Python开发的一套通用的进程管理程序,能将一个普通的命令行进程变为后台daemon,并监控进程状态,异常退出时能自动重启。它是通过fork/exec的方式把这些被管理的进程当作supervisor的子进程来启动,这样只要在supervisor的配置文件中,把要管理的进程的可执行文件的路径写进去即可。也实现当子进程挂掉的时候,父进程可以准确获取子进程挂掉的信息的,可以选择是否自己启动和报警。supervisor还提供了一个功能,可以为supervis
CentOS7安装Supervisor
陌北v1的博客
08-16
563
安装好后会生成一个配置文件。安装supervisor。
centos安装与配置supervisor
小菜鸟正洋洋的博客
03-10
446
安装supervisor
yum install -y supervisor
安装完成后启动服务
systemctl start supervisord
3.查看服务状态
systemctl status supervisord
4. 查看配置文件,新增自己的进程监听配置文件目录
vi /etc/supervisord.conf
5.进入刚才的目录,新增自己的配置
cd /etc/supervisord.d
6.配置参考
[program:laravel-worker]
process.
Centos 安装supervisor进程管理工具
蔡关荣的个人博客
08-25
173
supervisor官网:http://supervisord.org/introduction.html,supervisor是用Python开发的一个client/server服务,是Linux/Unix系统下的一个进程管理工具,不支持Windows系统。它可以很方便的监听、启动、停止、重启一个或多个进程。用Supervisor管理的进程,当一个进程意外被杀死,supervisort监听到进...
Centos在线安装supervisor管理jar服务以及离线安装
wd520521的博客
02-27
617
Centos7,8supervisor管理jar服务
一、安装supervisor
yum install epel-release -y
yum install -y supervisor
# 开机自启动
systemctl enable supervisord
#启动
#配置之文件自动生成
supervisord -c /etc/supervisord.conf
二、新建一个文件管理jar服务
vim /etc/supervisor.d/pap.ini
#文件示例
[progra
安装 Supervisor
一帆风顺的博客
07-17
1229
系统平台
cat /etc/redhat-releaseCentOS
Linux release 7.6.1810 (Core)
Python版本
python -V
Python 2.7.5
如果python版本低于2.6请升级,下面贴出一个安装python3.6.8的安装示例
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel .
centos7 安装配置supervisor详细教程
灬老夏灬
09-10
535
本文介绍使用的是yum安装supervisor,推荐给中小公司管理进程而使用supervisor的需要。背景:
Supervisor(http://supervisord.org/)是用Python开发的一个client/server服务,是Linux/Unix系统下的一个进程管理工具,不支持Windows系统。它可以很方便的监听、启动、停止、重启一个或多个进程。用Supervi...
centos7安装supervisor及配置文件详解
mr_legeek的博客
03-08
2474
centos7安装supervisor: 源码编译安装:下载源码文件:supervisor-3.3.1.tar.gz
下载地址:https://pypi.python.org/pypi/supervisor1234567891011121314安装:[root@cenots7 src]# tar -zxf supervisor-3.3.1.tar.gz[root@cenots7 src]# ...
centos安装supervisor详细教程
network_dream的博客
03-12
271
centos安装supervisor详细教程
名词解释
supervisor:要安装的软件的名称。
supervisord:装好supervisor软件后,supervisord用于启动supervisor服务。
supervisorctl:用于管理supervisor配置文件中program。
安装supervisor
使用yum命令安装
$ sudo su - #切换为root用户
yum install epel-release # 如果已安装EPEL源,请跳过
EPEL源详解
yum insta
CentOS7配置Supervisor
识途老码
09-27
540
CentOS7配置Supervisor1. 安装 Supervisor2. 配置 Supervisor3.启动 Supervisor #非必须执行4. 应用配置5. Supervisor 管理进程Web管理
Supervisor 的文档地址:http://www.supervisord.org/
1. 安装 Supervisor
#启用epel库
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
#安装
使用supervisor实现Doris进程自动拉起
hf200012的专栏
07-31
518
supervisor安装
1.使用yum命令安装(推荐)
yum install epel-release
yum install -y supervisor
systemctl enable supervisord # 开机自启动
systemctl start supervisord # 启动supervisord服务
systemctl status supervisord # 查看supervisord服务状态
ps -ef|grep supervisord # 查看是否存在supe
CENTOS7.9安装并配置supervisor服务
phplife的电子商务网上商城专栏
04-08
1680
这一段时间,开发团队小伙伴们开发的一goland微服务在不确定的时间会挂掉,影响线上调用此服务的稳定性,还没来得及排查挂掉的原因,同时这个golang开发的服务没有加入平滑重启的服务,所有只有启用supervisor这个进程控制系统来监控当服务挂掉后及时的重启服务降低对服务的影响
安装服务我喜欢用dnf,下面是安装和配置的过程
一、supervisor服务安装
yum update -y
yum install epel-release -y
yum install dnf -y
dnf updat
Centos 7安装Supervisord
muwenbofx的博客
04-09
437
Centos 7安装Supervisord一、pandas是什么?二、使用步骤1.引入库2.读入数据总结
一、pandas是什么?
示例:pandas 是基于NumPy 的一种工具,该工具是为了解决数据分析任务而创建的。
二、使用步骤
1.引入库
代码如下(示例):
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import warnings
warnings.filt
“相关推荐”对你有帮助么?
非常没帮助
没帮助
一般
有帮助
非常有帮助
提交
©️2022 CSDN
皮肤主题:精致技术
设计师:CSDN官方博客
返回首页
蘑菇猎手
CSDN认证博客专家
CSDN认证企业博客
码龄9年
暂无认证
49
原创
8万+
周排名
88万+
总排名
60万+
访问
等级
2931
积分
63
粉丝
137
获赞
60
评论
278
收藏
私信
关注
热门文章
python字典键值对的添加和遍历
133030
centos7安装supervisor详细教程
69080
解决Destroying ProtocolHandler [“ajp-apr-8009“]
68835
安装setuptools和pip
68035
python selenium打开新窗口,多窗口切换
51465
分类专栏
自动化
1篇
Python
20篇
爬虫
2篇
前端
3篇
ASP.NET
10篇
CSS
1篇
JSP
1篇
C#
4篇
设计模式
1篇
Django
2篇
selenium
2篇
数据库
5篇
linux
6篇
运维
10篇
数据结构与算法
最新评论
python3大端、小端(Big Endian、LittleEndian)编码
蘑菇猎手:
参考python官网:https://docs.python.org/zh-cn/3/library/stdtypes.html#int.to_bytes
[code=python]
1024.to_bytes(2, byteorder='big')
# b'\x04\x00'
int.from_bytes(b'\x04\x00',byteorder='big')
# 1024
[/code]
python3大端、小端(Big Endian、LittleEndian)编码
weixin_51660937:
同请教上个评论
解决psycopg2.DataError: invalid byte sequence for encoding "UTF8": 0x00
蘑菇猎手:
有具体的报错吗,贴出来看下
解决psycopg2.DataError: invalid byte sequence for encoding "UTF8": 0x00
leopoincare:
同遇到您这个问题,但是replace后无效呢
关于ASP.NET用VS2012出现数据库内容汉字乱码(中文乱码)或者汉字变问号(中文变问号)的解决办法,非常简单。
蘑菇猎手:
由于没有SQLServer环境,建议数据库名和列名改为英文或拼音,不要使用中文
您愿意向朋友推荐“博客详情页”吗?
强烈不推荐
不推荐
一般般
推荐
强烈推荐
提交
最新文章
postgresql查找配置文件位置、数据所在目录
VMwawre在NAT模式下为Deepin20虚拟机设置固定IP
记一次 Gitlab CI/CD 取消 job 后后续任务 pending 的解决
2021年5篇
2020年3篇
2019年6篇
2018年6篇
2017年5篇
2016年9篇
2015年16篇
目录
目录
分类专栏
自动化
1篇
Python
20篇
爬虫
2篇
前端
3篇
ASP.NET
10篇
CSS
1篇
JSP
1篇
C#
4篇
设计模式
1篇
Django
2篇
selenium
2篇
数据库
5篇
linux
6篇
运维
10篇
数据结构与算法
目录
评论 8
被折叠的 条评论
为什么被折叠?
到【灌水乐园】发言
查看更多评论
打赏作者
蘑菇猎手
你的鼓励将是我创作的最大动力
¥2
¥4
¥6
¥10
¥20
输入1-500的整数
余额支付
(余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付
您的余额不足,请更换扫码支付或充值
打赏作者
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额
抵扣说明:
1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。 2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。
余额充值