Home > Article > Operation and Maintenance > How is supervisor installed and configured?
Supervisor allows its users to control multiple processes on UNIX-like operating systems. The block is as follows:
Convenience
The need to write rc.d scripts for each process instance is often inconvenient. rc.dScripts are a common form of process initialization/automatic startup/management, but they can be painful to write and maintain. Additionally, the rc.d script cannot automatically restart a crashed process, and many programs do not restart gracefully when they crash. Supervisord starts processes as its child processes and can be configured to automatically restart them on crash. It can also be automatically configured to start the process in its own call.
Accuracy
It is often difficult to obtain accurate up/down status of processes on UNIX. Pidfiles often lie. Supervisord starts a process as a child process, so it always knows the true up/down status of its child processes and can easily query this data.
Process Groups
Processes often need to be started and stopped in groups, sometimes even in a "priority order". People often have trouble explaining this. Supervisor allows you to assign priorities to processes and allows users to launch them in a pre-assigned priority order by issuing commands such as "start all" and "restart all" through the supervisorctl client. Additionally, processes can be grouped into "process groups", a group of logically associated processes that can be stopped and started as a unit.
Simplicity
Supervisor is configured through a simple INI-style configuration file, making it easy to learn. It provides many per-process options to make your life easier, such as restarting failed processes and automatic log rotation.
Centralization
Processes can be controlled individually or in groups. You can configure Supervisor to provide local or remote command line and web interfaces.
Efficient
Supervisor starts its child process through fork/exec, and the child process does not perform background processing.
Strongly scalable
Supervisor has a simple event notification protocol that can be used by programs written in any language to manage it, as well as a XML-RPC interface. It is also built using extension points that can be leveraged by Python developers.
Compatible with
supervisor except Windows. It is tested and supported on Linux, Mac OS X, Solaris and FreeBSD. It is written entirely in Python, so a C compiler is not required for installation.
Stability
Supervisor has been around for many years and is used on many servers.
supervisord
supervisord server program. It is responsible for starting subroutines in its own call, responding to client commands, restarting subprocesses that crashed or exited, and recording its subprocess stdout and stderr Output, as well as generating and processing "events" corresponding to the life cycle of the child process.
Configuration file. This is typically located in /etc/supervisord.conf . This configuration file is a "Windows-INI" style configuration file. It is important to protect this file with appropriate file system permissions, as it may contain unencrypted usernames and passwords.
supervisorctl
Supervisor’s command line client is named supervisorctl. It provides a shell-like interface to the functionality provided by supervisor. From supervisorctl, the user can connect to a different supervisord, stop and start child processes, and obtain a list of running processes for supervisord.
The command line client communicates with the server through a UNIX domain socket or an Internet (TCP) socket. The server can assert that the client's user should present authentication credentials before allowing him to execute commands. The client process usually uses the same configuration file as the server, but any configuration file with a [supervisorctl] section will work fine.
Web Server
Web Server can be accessed through the browser to view and control the process status, configured in the [inet_http_server] block of the configuration file, access the server URL (e.g. http://localhost:9001/) to view and control process status through the web interface.
XML-RPC interface
The same HTTP server that serves the Web UI provides an XML-RPC interface that can be used to interrogate and control the supervisor and its running program. See the XML-RPC API documentation.
Installation and usage instructions click here wuguiyunwei.com
The above is the detailed content of How is supervisor installed and configured?. For more information, please follow other related articles on the PHP Chinese website!