Linux process management tool supervisor installation and configuration tutorial

Linux process management tool supervisor installation and configuration tutorial

Environment: CentOS 7

Official documentation: http://supervisord.org/

Install

# yum install -y epel-release
# yum install -y supervisor

start up

# supervisord -c /etc/supervisord.conf
# ps -ef | grep supervisor
root 19703 1 0 17:32 ? 00:00:00 /usr/bin/python /usr/bin/supervisord -c /etc/supervisord.conf
root 19715 19495 0 17:32 pts/0 00:00:00 grep --color=auto supervisor

Configuration Instructions

Configuration file address: /etc/supervisor.conf

If there is no configuration file, you can generate it with the following command:

echo_supervisord_conf > /etc/supervisord.conf

Configuration file details:

[unix_http_server]
file=/tmp/supervisor.sock ;UNIX socket file, supervisorctl will use
;chmod=0700 ;socket file mode, default is 0700
;chown=nobody:nogroup ;owner of the socket file, format: uid:gid

;[inet_http_server] ;HTTP server, providing web management interface
;port=127.0.0.1:9001 ;IP and port of the Web management backend. If it is open to the public network, you need to pay attention to security
;username=user ;Username for logging into the management backend
;password=123 ;Password for logging into the management backend

[supervisord]
logfile=/tmp/supervisord.log; log file, the default is $CWD/supervisord.log
logfile_maxbytes=50MB; The log file size will be rotated if it exceeds the limit. The default value is 50MB. If it is set to 0, it means there is no limit on the size.
logfile_backups=10; The default number of log file backups is 10. Setting it to 0 means no backup.
loglevel=info; log level, default info, others: debug,warn,trace
pidfile=/tmp/supervisord.pid ;pid file
nodaemon=false; whether to start in the foreground, the default is false, that is, start in daemon mode
minfds=1024; The minimum number of file descriptors that can be opened, the default is 1024
minprocs=200; The minimum number of processes that can be opened, the default is 200

[supervisorctl]
serverurl=unix:///tmp/supervisor.sock ; connect to supervisord via UNIX socket, the path is consistent with the file in the unix_http_server part
;serverurl=http://127.0.0.1:9001 ; Connect to supervisord via HTTP

; [program:xx] is the configuration parameter of the managed process, xx is the name of the process
[program:xx]
command=/opt/apache-tomcat-8.0.35/bin/catalina.sh run ; program startup command
autostart=true; automatically starts when supervisord starts
startsecs=10; If there is no abnormal exit after 10 seconds of startup, it means that the process started normally. The default is 1 second
autorestart=true; Automatically restart the program after exiting, optional values: [unexpected, true, false], the default is unexpected, which means that the process will be restarted only after it is unexpectedly killed
startretries=3 ; The number of automatic retries when startup fails, the default is 3
user=tomcat; Which user is used to start the process, the default is root
priority=999; The process startup priority, the default is 999, the smaller the value, the priority is
redirect_stderr=true; redirect stderr to stdout, default false
stdout_logfile_maxbytes=20MB; stdout log file size, default 50MB
stdout_logfile_backups = 20 ; Number of stdout log file backups, default is 10
; stdout log file. Please note that it cannot start normally if the specified directory does not exist, so you need to create the directory manually (supervisord will automatically create the log file)
stdout_logfile=/opt/apache-tomcat-8.0.35/logs/catalina.out
stopasgroup=false; The default is false. When a process is killed, whether to send a stop signal to this process group, including child processes
killasgroup=false; default is false, send kill signal to process group, including child processes

; Contains other configuration files
[include]
files = supervisord.d/*.ini ; You can specify one or more configuration files ending with .ini

Configuring Tomcat Testing

/etc/supervisord.d/tomcat.ini

[program:tomcat]
command=/opt/apache-tomcat-8.0.44/bin/catalina.sh run
stdout_logfile=/opt/apache-tomcat-8.0.44/logs/catalina.out
autostart=true
autorestart=true
startsecs=5
priority=1
stopasgroup=true
killasgroup=true

Restart Supervisor

supervisord -c /etc/supervisord.conf

Check

[root@gr5bm1tynui4toof-0622769 system]# supervisorctl
tomcat RUNNING pid 21609, uptime 0:25:15

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Installation and use of Linux operation and maintenance tool Supervisor (process management tool)
  • Installation, configuration and use of process daemon supervisor in Linux
  • Detailed explanation of Supervisor installation and configuration (Linux/Unix process management tool)
  • PHP programmers play Linux series using supervisor to implement daemon process
  • Learn how to use the supervisor watchdog in 3 minutes

<<:  Summary of knowledge points related to null (IFNULL, COALESCE and NULLIF) in MySQL

>>:  Method of implementing recursive components based on Vue technology

Recommend

The difference between ID and Name attributes of HTML elements

Today I am a little confused about <a href=&quo...

Detailed explanation of sql_mode mode example in MySQL

This article describes the sql_mode mode in MySQL...

How to process blob data in MySQL

The specific code is as follows: package epoint.m...

How to migrate sqlite to mysql script

Without further ado, I will post the code for you...

How to filter out duplicate data when inserting large amounts of data into MySQL

Table of contents 1. Discover the problem 2. Dele...

MySQL controls the number of attempts to enter incorrect passwords

1. How to monitor MySQL deadlocks in production e...

Vue application example code based on axios request encapsulation

Table of contents What is axios? Axios request ty...

Detailed tutorial on installation and configuration of MySql 5.7.17 winx64

1. Download the software 1. Go to the MySQL offic...

Solve the problem of Mac Docker x509 certificate

question Recently I needed to log in to a private...

About the correct way to convert time in js when importing excel

Table of contents 1. Basics 2. Problem Descriptio...

Examples of two ways to implement a horizontal scroll bar

Preface: During the project development, we encou...

How does MySQL ensure data integrity?

The importance of data consistency and integrity ...