Software and hardware environment
cat /etc/redhat-release # View the system version
Supervisor IntroductionSupervisor is a process management tool written in Python. It can easily monitor, start, stop, and restart one or more processes. When a process is killed unexpectedly, the supervisor can monitor the process death and easily restore the process automatically, without the need for programmers or system administrators to write code to control it. Supervisord installationyum install -y epel-release yum install -y supervisor Start & Enable Auto-Start systemctl start supervisord systemctl enable supervisord Other commands: systemctl stop supervisord #Stop and startsystemctl start supervisord #Startsystemctl status supervisord #Start statussystemctl reload supervisord #Heavy loadsystemctl restart supervisord #Restart Supervisor's web clientSupervisor provides web-based control. Administrators can start and restart processes by clicking buttons on the page, which is very convenient. Enter the configuration file and enable support for the web client vim /etc/supervisord.conf If it is provided for external access, the port needs to be changed to the local IP address #Uncomment lines 10-13. The numbers in front are line numbers [inet_http_server] ; inet (TCP) server disabled by default port=192.168.26.121: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)) After the configuration is complete, restart the service systemctl restart supervisord supervisord application configurationEnter the supervisord configuration file cat /etc/supervisord.conf The last line of the configuration file shows [include] files = supervisord.d/*.ini That is to say, all our application configuration files are saved in this directory and saved in .ini format. You can modify the address by yourself, but do not modify the suffix So let's create a monitored application Create a test python configurationCreate an application configuration called python vim /etc/supervisord.d/python.ini Configuration file content, where command is the command that needs to be executed when our application starts [program:python] #The python here is the monitoring name we display on the web front end and the terminal command=python /tmp/supervisordtest/test.py #The file address we want to monitor autostart=true autorestart=true startsecs=1 startretries=3 redirect_stderr=true stdout_logfile=/tmp/supervisordtest/access_python.log #Log address, you can configure the directory yourself stderr_logfile=/tmp/supervisordtest/error_python.log #Log address, you can configure the directory yourself Create test.py mkdir /tmp/supervisordtest vim /tmp/supervisordtest/test.py Program content: Start an infinite loop and keep printing content while True: print(100) Restart supervisord to make the configuration file take effect systemctl restart supervisord Check whether the application starts normally 1. Command view systemctl status supervisord 2. Visual web viewing The web terminal can restart, stop, clean up logs, view logs and other operations Several commands related to supervisor After the installation is complete, three system commands 1. 2. supervisorctl is a command line management tool that can be used to execute sudo supervisorctl start demoweb demoweb is the name of the process. For detailed commands and instructions, see the table below.
3. echo_supervisord_conf Used to generate the default configuration file (the default configuration file is very complete and has comments, suitable for reference when needed, the usage is as follows echo_supervisord_conf > test.conf This is the end of the article about how to learn to use supervisor watchdog in 3 minutes. For more information about how to use supervisor in 3 minutes, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Discussion on the way to open website hyperlinks
>>: A preliminary understanding of CSS custom properties
Background: A long time ago (2017.6.5, the articl...
Management of input and output in the system 1. U...
MySQL Performance Optimization MySQL is widely us...
During today's lecture, I talked about the di...
<br />I have compiled some domestic design w...
question For a given MySQL connection, how can we...
Preface I believe everyone has used the top comma...
This article describes how to use docker to deplo...
Table of contents Preface 1. ss command 2. Overal...
Query the current date SELECT CURRENT_DATE(); SEL...
The pitfalls of MySQL read-write separation The m...
Nginx cross-domain configuration does not take ef...
Table of contents 1. Overview 2. Memory Managemen...
Open the connection tool. I use MobaXterm_Persona...
Disable Build Partition expressions do not suppor...