`
sillycat
  • 浏览: 2542478 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Supervisor 2019(1)CentOS 7

 
阅读更多
Supervisor 2019(1)CentOS 7

Install the current latest version on CentOS 7
> sudo yum install supervisor

After installation, check the default configuration
> echo_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=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=/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: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)
;autorestart=unexpected        ; whether/when to restart (default: unexpected)
;startsecs=1                   ; number of secs prog must stay running (def. 1)
;startretries=3                ; max # of serial start failures (default 3)
;exitcodes=0,2                 ; 'expected' exit codes for process (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)
; 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)
;autorestart=unexpected        ; whether/when to restart (default: unexpected)
;startsecs=1                   ; number of secs prog must stay running (def. 1)
;startretries=3                ; max # of serial start failures (default 3)
;exitcodes=0,2                 ; 'expected' exit codes for process (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_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        ; # 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 = relative/directory/*.ini

Usually, we should not change the default configuration, we should use other file
> vi /etc/supervisord.conf
[unix_http_server]
file=/var/run/supervisor/supervisor.sock   ; (the path to the socket file)
[inet_http_server]         ; inet (TCP) server disabled by default
port=0.0.0.0:9001
username=sillycat
password=123456
[supervisord]
logfile=/var/log/supervisor/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=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false              ; (start in foreground if true;default false)
minfds=65536                 ; (min. avail startup file descriptors;default 1024)
minprocs=32769                ; (min. avail process descriptors;default 200)

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=unix:///var/run/supervisor/supervisor.sock ; use a unix:// URL  for a unix socket

Example for monitor Elasticsearch
[program:elasticsearch]
user=elastic
command=/home/elastic/tool/elasticsearch-7.2.1/bin/elasticsearch
autostart=true
autorestart=true
environment=ES_HEAP_SIZE=2g
stdout_logfile=/var/log/supervisor/elasticsearch.out.log
stderr_logfile=/var/log/supervisor/elasticsearch.err.log

Example for monitor kibana
[program:kibana]
user=elastic
command=/home/elastic/tool/kibana-7.2.1/bin/kibana
autostart=true
autorestart=true
stdout_logfile=/var/log/supervisor/kibana.out.log
stderr_logfile=/var/log/supervisor/kibana.err.log

I increate the default settings
minfds=65536                 ; (min. avail startup file descriptors;default 1024)
minprocs=32769                ; (min. avail process descriptors;default 200)

Enable the service
> sudo systemctl enable supervisord

Start the service
> sudo systemctl start supervisord

Check status
> sudo systemctl enable supervisord

We can easily visit the UI
http://centos-dev1:9001/

According to the docs from here https://www.jianshu.com/p/bf2b3f4dec73, we can do more settings and configurations.
[include]
files = supervisord.d/*.ini

We can put the programs configuration separately in the supervisord.d/*.ini


References:
http://supervisord.org/
https://www.jianshu.com/p/bf2b3f4dec73

分享到:
评论

相关推荐

    xudong7930#centos6#centos7_安装_使用_supervisor1

    centos7_安装_使用_supervisor1.安装和启动yum -y install supervisor添加项目vim /etc/supervisord

    centos7使用supervisor的详细教程

    **CentOS 7 使用 Supervisor 的详细教程** Supervisor 是一个基于 Python 开发的进程管理工具,它可以将普通的命令行进程转换为后台守护进程,并且能够持续监控进程的状态,当进程意外退出时,Supervisor 可以自动...

    supervisor-3.3.1离线安装包

    1. `supervisord.conf`:这是Supervisor的主配置文件,包含了所有要管理的程序定义以及Supervisor的全局设置。用户可以通过编辑此文件来定制Supervisor的行为,如指定日志位置、进程启动命令等。 2. `守护工具配置....

    Centos-supervisor安装与netcore进程守护.docx

    **CentOS上的Supervisor安装与.NET Core进程守护** 在服务器管理中,确保应用程序稳定运行是至关重要的。`Supervisor`是一个用Python编写的进程管理工具,它可以用来管理和监控后台进程,确保它们在出现异常时自动...

    Centos7+.NetCore2+MySql5.7+nginx+Supervisor安装过程(含示例)

    在CentOS7中搭建.NetCore2.0(.net跨平台)运行环境,使用MySql5.7数据库,nginx代理, Supervisor作为进程守护。含有.NetCore+EF Code First+MySql+Swagger示例代码。

    基于centos6.5 的 supervisor离线部署包

    基于centos6.5 的 supervisor离线部署包,解压后,执行shell脚本即可完成supervisor部署操作,由于supervisor依赖于python2.7 在本安装包内,后将系统python升级到python2.7 ,如果对此操作有异议的同学需谨慎。...

    supervisor-3.4.0.tar.gz

    安装 `supervisor` 一般通过包管理器完成,例如在Ubuntu上使用`apt-get install supervisor`,在CentOS/RHEL上使用`yum install supervisor`。安装完成后,需要根据实际需求编辑配置文件,并启动`supervisor`服务。 ...

    centos7 安装supervisor教程以及常见问题

    Supervisor 是一个进程控制系统。它是一个 C/S 系统 (注意:其提供 WEB 接口给用户查询和控制)。它允许用户去监控和控制在类 UNIX 系统的进程。它的目标与 launchd、daemontools 和 runit 有些相似。但是与它们不...

    用uwsgi+daphne+Nginx+supervisor部署Django项目.docx

    - 操作系统:CentOS 7 - Python版本:3.6 - Django版本:2.2 #### 四、安装Python3 1. **添加Python3的YUM源** ```bash yum install -y https://centos7.iuscommunity.org/ius-release.rpm ``` 2. **更新YUM...

    supervisor在linux环境下的离线安装包

    如果没有安装或版本不符合要求,可以通过包管理器(如 `apt-get` 对于 Debian/Ubuntu 或 `yum` 对于 CentOS/RHEL)安装最新版本的 Python。 **离线安装 Supervisor:** 1. **解压下载的压缩包:** 首先,将下载的 ...

    supervisor:CentOS + Supervisord Docker 镜像

    CentOS + Supervisord Docker 镜像此图像旨在作为其他图像的基础。 它是模型的重建,用 CentOS 替换了 Ubuntu。 要使用它,只需将特定于应用程序的配置文件(带有 .conf 扩展名)添加到/etc/supervisor/conf.d/*....

    centos6.5升级安装配置supervisor的教程

    本文将详细讲解如何在CentOS 6.5上进行Supervisor的升级安装和配置,以便更好地管理和监控后台进程。 首先,我们要了解Supervisor的核心功能。Supervisor是一个基于Python的客户端/服务器系统,它允许用户通过网络...

    centos7下安装并配置supervisor守护程序的操作方法

    新手,自己记录一下1、安装supervisor。supervisor是基于Pyshon开发的,安装supervisor时会自动安装Python依赖项,所以不需要额外的安装操作 # yun install supervisor 2、安装成功后查看/etc下生成了相关文件和...

    supervisor-3.3.4.tar.gz

    在描述中提到的CentOS7环境下,Python2.7已经默认安装,这符合Supervisor的运行需求。接下来,我们可以按照以下步骤安装和配置Supervisor: 1. 安装pip(Python的包管理器):`sudo yum install python-pip` 2. ...

    supervisor安装文档

    在 CentOS 6 和 7 中,首先需要添加 EPEL (Extra Packages for Enterprise Linux) 软件源,因为 Supervisor 不包含在默认的软件仓库中。对于 CentOS 6,可以使用以下命令下载并安装 EPEL 和 Supervisor: ```bash ...

    ASP.NET Core应用程序部署至生产环境中(CentOS7)

    ### ASP.NET Core应用程序部署至生产环境中(CentOS7) #### 环境说明与准备工作 在部署ASP.NET Core应用程序到CentOS 7.2.1511的生产环境中,首先需要确保具备以下条件和环境: - **服务器系统**:CentOS 7.2....

    erlang-19.0.4-1.el7.centos.x86_64.rpm

    “erlang-19.0.4-1.el7.centos.x86_64.rpm”这个文件是Erlang的RPM软件包,用于在基于Red Hat Enterprise Linux 7(CentOS 7)的系统上安装Erlang 19.0.4版本。RPM是Red Hat Package Manager的缩写,是Linux系统中...

Global site tag (gtag.js) - Google Analytics