Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and configure Linux process management tool supervisor

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains how to install and configure Linux process management tool supervisor, the content is clear, interested partners can learn, I believe it will be helpful after reading.

Environment: CentOS 7

Installation

# yum install-y epel-release

# yum install-y supervisor

Start

# 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 description

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

Detailed description of the profile:

[unix_http_server]

File=/tmp/supervisor.sock; UNIX socket file, supervisorctl will use the

; chmod=0700; mode of socket file. Default is 0700.

; chown=nobody:nogroup; owner of the socket file, format: uid:gid

; [inet_http_server]; HTTP server, which provides web management interface

; port=127.0.0.1:9001; Web manages the IP and ports running at the backend. If it is open to the public network, you need to pay attention to security.

; username=user; login to the user name of the administrative backend

; password=123; password for logging in to the administrative backend

[supervisord]

Logfile=/tmp/supervisord.log; log file. Default is $CWD/supervisord.log.

Logfile_maxbytes=50MB; log file size, which exceeds rotate. Default is 50MB. If set to 0, there is no limit on the size.

Logfile_backups=10; the number of reserved backups for log files is 10 by default, and 0 means no backups

Loglevel=info; log level, default info, other: debug,warn,trace

Pidfile=/tmp/supervisord.pid; pid file

Nodaemon=false; whether to start in the foreground. The default is false, that is, it starts in the way of daemon.

Minfds=1024; the minimum value of the file descriptor that can be opened. Default is 1024.

Minprocs=200; the minimum number of processes that can be opened. Default is 200.

[supervisorctl]

Serverurl=unix:///tmp/supervisor.sock; connect to supervisord through UNIX socket, and the path is the same as that of file in unix_http_server

; serverurl= http://127.0.0.1:9001; connect to supervisord through HTTP

; [program:xx] is the configuration parameter of the managed process, and 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; also starts automatically when supervisord starts

Startsecs=10; if there is no abnormal exit after 10 seconds, it means that the process has started normally. The default is 1 second.

Autorestart=true; restarts automatically after the program exits. Available value: [unexpected,true,false]. Default is unexpected, which means the process will not restart until it is killed unexpectedly.

Startretries=3; automatic retry number of failed startup. Default is 3.

User=tomcat; which user to start the process with? default is root.

Priority=999; process startup priority. Default is 999, and those with small values start first.

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, it should be noted that it cannot be started normally when the specified directory does not exist, so you need to create a directory manually (supervisord will automatically create log files)

Stdout_logfile=/opt/apache-tomcat-8.0.35/logs/catalina.out

Stopasgroup=false; default is false. Whether to send stop signals to the process group, including child processes, when the process is killed

Killasgroup=false; defaults to false, which sends kill signals to the process group, including child processes

; contains other configuration files

[include]

Files = supervisord.d/*.ini; you can specify one or more configuration files that end with .ini

Configure Tomcat Test

/ 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

View

[root@gr5bm1tynui4toof-0622769 system] # supervisorctl

Tomcat RUNNING pid 21609, uptime 0:25:15

After reading the above, do you have a further understanding of how to install and configure Linux process management tool supervisor? if you want to learn more, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report