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

Detailed explanation on how to get the IP address of a docker container

1. After entering the container cat /etc/hosts It...

Solution - BASH: /HOME/JAVA/JDK1.8.0_221/BIN/JAVA: Insufficient permissions

1) Enter the folder path where the jdk file is st...

js canvas realizes random particle effects

This article example shares the specific code of ...

Combining XML and CSS styles

student.xml <?xml version="1.0" enco...

MySQL 8.0.22 winx64 installation and configuration method graphic tutorial

The database installation tutorial of MySQL-8.0.2...

Using jQuery to implement the carousel effect

This article shares the specific code for impleme...

MySQL 5.7.18 installation tutorial under Windows

This article explains how to install MySQL from a...

Analysis of the cause of docker error Exited (1) 4 minutes ago

Docker error 1. Check the cause docker logs nexus...

MYSQL unlock and lock table introduction

MySQL Lock Overview Compared with other databases...

Detailed explanation of webpack-dev-server core concepts and cases

webpack-dev-server core concepts Webpack's Co...

MySQL database deletes duplicate data and only retains one method instance

1. Problem introduction Assume a scenario where a...

Detailed usage of docker-maven-plugin

Table of contents Docker-Maven-Plugin Maven plugi...

Double loading issue when the page contains img src

<br />When the page contains <img src=&qu...