Supervisor Process Management tool to detect the status of the process at all times, can be used to start, restart, shutdown process;
Supervisord (Supervisor is a C/S model of the program, which is the server side, corresponding to the client side: SUPERVISORCTL) and applications (that is, we want to manage the program).
First, Download:
https://pypi.python.org/packages/80/37/964c0d53cbd328796b1aeb7abea4c0f7b0e8c7197ea9b0b9967b7d004def/ Supervisor-3.3.1.tar.gz#md5=202f760f9bf4930ec06557bac73e5cf2
# CD Supervisor
# python setup.py Build
Prompt to install MELD3 version requires who 0.6.5 above;
Searching for meld3>=0.6.5
https://pypi.python.org/packages/45/a0/317c6422b26c12fe0161e936fc35f36552069ba8e6f7ecbd99bbffe32a5f/ Meld3-1.0.2.tar.gz#md5=3ccc78cd79cffd63a751ad7684c02c91
# CD MELD3
# python setup.py Install
# CD Supervisor
# python setup.py Install
Detection
>>> Import Supervisor See if it will load successfully.
Second, or direct yum install Supervisor
Start
Supervisord-c/etc/supervisord.conf
If the configuration file is modified
The configuration needs to be reloaded;
Supervisorctl Reload
Three, supervisord.conf example;
[Unix_http_server]
File=/tmp/supervisor.sock; UNIX socket file, SUPERVISORCTL will use
; chmod=0700; Socket file mode, default is 0700
; chown=nobody:nogroup; The owner of the socket file, format: Uid:gid
; [Inet_http_server] ; HTTP server, providing Web management interface
;p ort=127.0.0.1:9001; Web Management background Run IP and port, if open to public network, need to pay attention to security
; username=user; User name for login admin background
;p assword=123; Password for login admin background
[Supervisord]
Logfile=/tmp/supervisord.log; Log file, default is $CWD/supervisord.log
LOGFILE_MAXBYTES=50MB; Log file size, exceeding rotate, default 50MB
logfile_backups=10; Log files retain the number of backups by default 10
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 to start daemon
minfds=1024; The minimum value of the file descriptor that can be opened, default 1024
minprocs=200; Minimum number of processes that can be opened, default 200
[Rpcinterface:supervisor]
Supervisor.rpcinterface_factory = Supervisor.rpcinterface:make_main_rpcinterface
[Supervisorctl]
Serverurl=unix:///tmp/supervisor.sock; The path is consistent with the file in the Unix_http_server section via the UNIX socket connection Supervisord
; serverurl=http://127.0.0.1:9001; Connect to Supervisord via HTTP
/etc/supervisor/can be used to store these configuration files, corresponding to the/etc/supervisord.conf in the include section of the configuration modified:
[include]
Files =/etc/supervisor/*.conf
Iv. Program Configuration Example
[Program:redis]
directory =/data/redis; Startup directory of the program
Command =./redis-server redis.conf; Start command, you can see the same as the command that is started manually on the command line
Autostart = true; It starts automatically when the Supervisord is started.
Startsecs = 5; No exception exits after 5 Seconds of startup, as if it had started normally.
AutoRestart = true; Automatic restart after program exits unexpectedly
Startretries = 3; Startup failed auto Retry number, default is 3
user = Leon; With which user to start
Redirect_stderr = true; REDIRECT stderr to stdout, default false
Stdout_logfile_maxbytes = 20MB; StdOut log file size, default 50MB
Stdout_logfile_backups = 20; StdOut number of log file backups
; StdOut log file, be aware that it does not start properly when the specified directory does not exist, so you need to create the directory manually (Supervisord automatically creates the log file)
Stdout_logfile =/data/supervisor/logs/redis_stdout.log
Start; ( point to Configuration start )
Supervisorctl-c/etc/supervisord.conf
Perform supervisorctl view status;
> Status # View program state
This article is from the "Logs" blog, make sure to keep this source http://51log.blog.51cto.com/6076767/1924728
Supervisor Process Management Tools