标签:备份 python load jdk ble 管理 ORC 绝对路径 bin
一.supervisor简介注意:
supervisor在docker里管理多个进程十分方便
二.安装
1.通过python pip安装
yum install python-setuptools
easy_install pip
pip install supervisor
2.创建配置文件夹
mkdir /etc/supervisor 主配置文件夹
mkdir /etc/supervisor/conf.d 子进程文件夹
mkdir /etc/supervisor/pid 主进程pid
mkdir /etc/supervisor/run 主进程socket
3.创建supervisor 主配置文件
vim /etc/supervisor/supervisord.conf
[supervisord]
logfile = /etc/supervisor/log/supervisord.log
logfile_maxbytes = 50MB
logfile_backups=10
loglevel = info
pidfile = /etc/supervisor/run/supervisord.pid
nodaemon = false
minfds = 1024
minprocs = 200
umask = 022
user = root
identifier = supervisor
directory = /etc/supervisor/
nocleanup = true
childlogdir = /etc/supervisor/log
strip_ansi = false
[supervisorctl]
serverurl = unix:///etc/supervisor/run/supervisord.sock
#serverurl = http://127.0.0.1:9001
prompt = supervisor
chmod = 0777
[unix_http_server]
file=/etc/supervisor/run/supervisord.sock
[inet_http_server]
port=*:9001
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[include]
files=/etc/supervisor/conf.d/*.conf
4.启动服务
supervisord -c /etc/supervisor/supervisord.conf
三.创建nginx服务,使用supervisor监控服务进程
1.源码编译安装nginx
测试手动可以正常启动nginx
2.在/etc/supervisor/conf.d 创建nginx服务进程配置文件
vim /etc/supervisor/conf.d/nginx.conf
[program:nginx]
command=/usr/local/nginx/sbin/nginx -g ‘daemon off;‘
process_name=nginx
directory=/usr/local/nginx
autostart=true
autorestart=true
startsecs=10
startretries=2
exitcodes=0,2
stopsignal=TERM
stopwaitsecs=10
user=root
redirect_stderr=true
stdout_logfile=NONE
redirect_stdout=true
stderr_logfile=NONE
3.启动服务,正常
[root@server2 conf.d]# supervisorctl update
[root@server2 conf.d]# supervisorctl status
四.创建tomcat服务,使用supervisor监控服务进程
1.安装java
2.安装tomcat
.
3.在/etc/supervisor/conf.d 创建tomcat服务进程配置文件
vim /etc/supervisor/conf.d/tomcat.conf
[program:tomcat]
command=/usr/local/apache-tomcat-8.5.53/bin/catalina.sh run
process_name=tomcat
numprocs=1
directory=/usr/local/apache-tomcat-8.5.53
autostart=true
autorestart=true
startsecs=10
startretries=2
exitcodes=0,2
stopsignal=TERM
stopwaitsecs=10
user=root
redirect_stderr=true
stdout_logfile=NONE
redirect_stdout=true
stderr_logfile=NONE
environment=JAVA_HOME="/usr/jdk/",JAVA_BIN="/usr/jdk/bin"
4.启动服务,正常
[root@server2 conf.d]# supervisorctl update
[root@server2 conf.d]# supervisorctl status
web界面
五.命令简介
supervisorctl status //查看所有进程的状态
supervisorctl stop nginx //停止nginx
supervisorctl start nginx //启动nginx
supervisorctl restart nginx //重启nginx
supervisorctl update //配置文件修改后使用该命令加载新的配置
supervisorctl reload //重新启动配置中的所有程序
六.program配置讲解
标签:备份 python load jdk ble 管理 ORC 绝对路径 bin
原文地址:https://blog.51cto.com/anfishr/2483177