supervisord 安装、配置体验

使用supervisord web页面管理 mall-web.jar进程

1.安装easy_install

sudo yum install python-2.6

2.安装Supervisor

easy_install supervisor-3.2

3.生成配置文件

echo_supervisord_conf > /etc/supervisord.conf

Supervisor安装完成,配置文件模板在/etc/supervisord.conf中生成,在不指定配置文件位置的情况下,Supervisord和Supervisorctl会按照以下三个顺序来搜索配置文件位置。

1.$CWD/supervisord.conf

2.$CWD/etc/supervisord.conf

3./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".
;  - Comments must have a leading space: "a=b ;comment" not "a=b;comment".

[unix_http_server]
file=/tmp/supervisor.sock   ; (the path to the socket file)
chmod=0777                 ; 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=192.168.11.232:9001        ; (ip_address:port specifier, *:port for all iface)
#username=admin              ; (default is no username (open server))
#password=admin             ; (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           ; (num of main logfile rotation backups;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)
;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 below 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: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=unix:///tmp/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 http_username if set
;password=123                ; should be same as http_password if set
;prompt=mysupervisor         ; cmd line prompt (default "supervisor")
;history_file=~/.sc_history  ; use readline history if available

; The below sample program section shows all possible program subsection values,
; create one or more ‘real‘ program: sections to be able to control them under
; supervisor.

;[program:yourname]
;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 (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 (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)

[program:mall-web]
command=/data/app/start-app.sh mall-web
process_name=%(program_name)s
numprocs=1
user=root
autostart=true
autorestart=true
startsecs=5
startretries=3
redirect_stderr=true
stdout_logfile=/var/log/supervisor/mall-web.log
stdout_logfile_maxbytes=20MB
stdout_logfile_backups=10
stopasgroup=true

; The below sample eventlistener section shows all possible
; eventlistener subsection values, create one or more ‘real‘
; eventlistener: sections to be able to handle event notifications
; sent by supervisor.

;[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 (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 (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 below sample group section 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 = /data/liudg/supervisor/conf.d/*.conf

配置完成后,使用supervisord启动服务,发现以下错误:

1.出现多个mall-web.jar进程,发现出现此问题是因为之前有启动mall-web.jar进程没有stop

2.出现关闭不掉进程并且提示如图:

之后发现mall-web.jar是一个daemon,而supervisord 是用来跑前台程序的,于是在command=/data/app/start-app.sh mall-web后面添加-D FOREGROUND解决

时间: 2024-10-19 13:56:20

supervisord 安装、配置体验的相关文章

Exchange2016正式版功能介绍及全新安装配置

Exchange2016功能介绍及全新安装配置 说到Exchange服务相信很多人都在关注,微软在2015年更新了很多服务,从功能上来说确实做了很多优化及提升,具体就不多说了,微软在2015年10月1日发布了Exchange2016正式版,版本还是分为标准版和企业版,此次发布为多语言版本 同样微软在2015年发布了那些新产品呢 : 我们还是说说Exchange2016,从安装及官网文档上看微软从Exchange2010到Exchange2016角色上缩减了很多,从Exchange2010的Mai

Python中scrapy框架如何安装配置

在python学习群里发现很多学习网络爬虫技术的童靴都搞不懂python爬虫框架scrapy的安装配置,在学习python网络爬虫初级阶段的时候我们利用urllib和urllib2库以及正则表达式就可以完成了,不过遇到更加强大的爬虫工具--爬虫框架Scrapy,这安装过程也是煞费苦心哪,在此整理如下. Windows平台: 我的系统是Win7,首先,你要有Python,我用的是2.7.7版本,Python3相仿,只是一些源文件不同. 官网文档:http://doc.scrapy.org/en/l

Python爬虫进阶三之Scrapy框架安装配置

初级的爬虫我们利用urllib和urllib2库以及正则表达式就可以完成了,不过还有更加强大的工具,爬虫框架Scrapy,这安装过程也是煞费苦心哪,在此整理如下. Windows 平台: 我的系统是 Win7,首先,你要有Python,我用的是2.7.7版本,Python3相仿,只是一些源文件不同. 官网文档:http://doc.scrapy.org/en/latest/intro/install.html,最权威哒,下面是我的亲身体验过程. 1.安装Python 安装过程我就不多说啦,我的电

第【一】部分Netzob项目工具的安装配置by tsy

声明: 1)本报告由博客园bitpeach撰写,版权所有,免费转载,请注明出处,并请勿作商业用途. 2)若本文档内有侵权文字或图片等内容,请联系作者bitpeach删除相应部分. 3)本文档内容涉及Netzob工具的安装配置,请勿认为本文是讲述使用,Netzob的使用是不在本文讲述的,下一篇博文应该会写Netzob的使用手册. 4)仅仅作为参考用途,抛砖引玉,不作为证据证明用途,请自行取舍,核实引用.文中图片大多为本人原创,如有引用他人图片会注明的. 0目录 目录 0目录    1 [1]引言 

ZooKeeper学习第二期--ZooKeeper安装配置

一.Zookeeper的搭建方式 Zookeeper安装方式有三种,单机模式和集群模式以及伪集群模式. ■ 单机模式:Zookeeper只运行在一台服务器上,适合测试环境:■ 伪集群模式:就是在一台物理机上运行多个Zookeeper 实例:■ 集群模式:Zookeeper运行于一个集群上,适合生产环境,这个计算机集群被称为一个"集合体"(ensemble) Zookeeper通过复制来实现高可用性,只要集合体中半数以上的机器处于可用状态,它就能够保证服务继续.为什么一定要超过半数呢?这

Linux 后台进程管理器 supervisor 安装配置(使用httpd来做被监控进程)

在linux服务需要可靠的运行,并且服务exit后,需要自动重新启动起来,还可以监控进程状态,supervisor就是个不错的选项,supervisor是用python开发的一个进程管理器.下面是安装配置过程. 1.安装supervisor easy_install supervisor     SetupTool安装方法 apt-get install supervisor    Debian/Ubuntu安装方法 yum install supervisor     RedHat/Cento

ZooKeeper安装配置

一.Zookeeper的搭建方式 Zookeeper安装方式有三种,单机模式和集群模式以及伪集群模式. ■ 单机模式:Zookeeper只运行在一台服务器上,适合测试环境:■ 伪集群模式:就是在一台物理机上运行多个Zookeeper 实例:■ 集群模式:Zookeeper运行于一个集群上,适合生产环境,这个计算机集群被称为一个“集合体”(ensemble) Zookeeper通过复制来实现高可用性,只要集合体中半数以上的机器处于可用状态,它就能够保证服务继续.为什么一定要超过半数呢?这跟Zook

转载maven安装,配置,入门

转载:http://www.cnblogs.com/dcba1112/archive/2011/05/01/2033805.html 本书代码下载 大家可以从我的网站下载本书的代码:http://www.juvenxu.com/mvn-in-action/,也可以通过我的网站与我取得联系,欢迎大家与我交流任何关于本书的问题和关于Maven的问题. 咖啡与工具 本书相当一部分的内容是在苏州十全街边的Solo咖啡馆完成的,老板Yin亲手烘焙咖啡豆.并能做出据说是苏州最好的咖啡,这小桥流水畔的温馨小

SQL Server 2016 CTP3 集成R语言安装配置手册

1. 适用范围 SQL Server 2016 CTP3基于 Windows Server 2016 TP3进行单机R集成部署指引手册 非域环境,R非群集 2. 安装准备 2.1 硬件准备 MSDN建议最低1GB内存,但我们考虑到R需要大量内存进行计算故建议至少4GB 2.2 软件准备 Revolution R Open 3.2.2 for Revolution R Enterprise 7.5.0 http://go.microsoft.com/fwlink/?LinkId=626650 Re

PHP 7安装使用体验,升级PHP要谨慎

一.发挥PHP 7高性能的几个要点 PHP 7相对于之前的PHP版本来说可以说性能有了质的飞跃,但是所谓“好马配好鞍,好车配风帆”,想要发挥PHP 7的性能优势,还需要从以下几个方面做准备:(此部分引自PHP7核心开发者, Yaf, Yar, Yac等项目作者:Laruence). 1. 记得启用Zend Opcache,启用Opcache非常简单, 在php.ini配置文件中加入: ? 1 2 3 zend_extension=opcache.so opcache.enable=1 opcac