1. Basic information
Supervisor is a set of general process management programs developed in Python, which can turn a common command line process into a background daemon, monitor the process status, and automatically restart when it exits abnormally. It uses fork/exec to start these managed processes as child processes of the supervisor, so as long as the path of the executable file of the process to be managed is written in the supervisor's configuration file. It also realizes that when the child process hangs up, the parent process can accurately obtain the information that the child process hangs, and can choose whether to start and alarm by itself. Supervisor also provides a function to set a non-root user for supervisord or each child process, and this user can manage its corresponding process.
2. Environmental preparation
1. System description
System: CentOS-7-x86_64-Minimal-1708
download link:
http://archive.kernel.org/centos-vault/7.4.1708/isos/x86_64/
2. VMware version: VMware Workstation Pro15
3. Install the virtual machine
Reference https://blog.csdn.net/llwy1428/article/details/89328381
4. Tools: xshell5
5. JDK version: jdk1.8
Refer to https://blog.csdn.net/llwy1428/article/details/85232267
Three, installation and configuration
1. Install basic tools
[root@localhost ~]# yum install vim lrzsz net-tools epel-release -y
[root@localhost ~]# yum update -y
2. Install supervisor
[root@localhost ~]# yum install -y supervisor
3. Set boot up
[root@localhost ~]# systemctl enable supervisord
Created symlink from /etc/systemd/system/multi-user.target.wants/supervisord.service to /usr/lib/systemd/system/supervisord.service.
4. Start the service
[root@localhost ~]# systemctl start supervisord
5. View the service startup status
[root@localhost ~]# systemctl status supervisord
6. Check if there is a supervisord process
[root@localhost ~]# ps -ef|grep supervisord
7. Stop service
[root@localhost ~]# systemctl stop supervisord
8. Reload configuration information
[root@localhost ~]# systemctl reload supervisord
9, restart the service
[root@localhost ~]# systemctl restart supervisord
10. Modify configuration information
Note: Pay attention to setting the user name and password in the public network environment (the following environment is implemented in a personal virtual machine)
[root@localhost ~]# vim /etc/supervisord.conf
11. Restart the service and check the port it started
[root@localhost ~]# systemctl restart supervisord
[root@localhost ~]# netstat -lntp
Note: 9001 is the port occupied by the service startup.
12. Firewall settings
The server opens port 9001
[root@localhost ~]# firewall-cmd --zone=public --add-port=9001/tcp --permanent
[root@localhost ~]# systemctl restart firewalld
Other firewall operations can refer to:
https://blog.csdn.net/llwy1428/article/details/99676257
13, browser view
Enter the browser address bar: http://192.168.11.17:9001/ 192.168.11.17 is the ip of my virtual machine
Monitor other services
Reference: https://blog.csdn.net/llwy1428/article/details/105335972
At this point, Centos7 installation and configuration supervisor operation is complete!