realize Process service Management,supervisort hearing process after death, will automatically pull it back, very convenient to do the process of automatic recovery function, no longer need to write shell scripts to control
Installation process
1, to the official website to download the latest version, unzip the compilation,
TAR-ZXVF supervisor-3.3.4.tar.gz
CD supervisor-3.3.4
python setup.py install
You may encounter the following error:
Installed/usr/lib/python2.7/site-packages/supervisor-3.3.4-py2.7.egg
processing dependencies for supervisor==3.3.4
Searching for meld3>=0.6.5
Reading https://pypi.python.org/simple/meld3/
Download error on https://pypi.python.org/simple/meld3/: [Errno 1] _ssl.c:504:error:14090086:ssl routines: Ssl3_get_server_certificate:certificate Verify failed--Some packages May is found!
couldn ' t find index page for ' Meld3 ' (maybe misspelled?)
Scanning index of all packages
Reading https://pypi.python.org/simple/
Download error on https://pypi.python.org/simple/: [Errno 1] _ssl.c:504:error:14090086:ssl routines:ssl3_get_ Server_certificate:certificate Verify failed--Some packages May is found!
No Local Packages or download links found for meld3>=0.6.5
error:could not find suitable distribution for requirement.parse (' meld3>=0.6.5 ')
Workaround:
tar-xf meld3-1.0.1.tar.gz
CD meld3-1.0.1
python setup.py install
re-execute the Install Supervisor package
Build configuration file
echo_supervisord_conf >/etc/supervisord.conf
View configuration files
cat/etc/supervisord.conf |grep-v ";" | Grep-v "^$"
[email protected] ~]# cat/etc/supervisord.conf |grep-v ";" | Grep-v "^$"
[Unix_http_server]
[Supervisord]
[Rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[Supervisorctl]
Configure the Web management process
[Inet_http_server]
port=127.0.0.1:9001; server IP
username=xxx; custom
password=xxx; custom
Create an Administrative profile directory
Mkdir/etc/supervisord
Edit the configuration file, at the bottom of the configuration file, configure the Include
[include]
files=/etc/supervisord/*.conf
Start
supervisord-c/etc/supervisord.conf
#在
Add a configuration file for MySQL instance under the/etc/supervisord directory as follows:
[[email protected] supervisord] # cat mysql_3306.conf
[program:mysql_3306]
#command =/etc/init.d/mysql start--port=3306--sleep=3-- tryies=3--daemon
Command=/usr/local/mysql/bin/mysqld_safe--defaults-file=/etc/my.cnf--datadir=/var/lib/ mysql/--pid-file=/var/lib/mysql/host-172-16-32-152.pid--basedir=/usr/local/mysql--log-error=/var/lib/mysql/ Mariadb.log--user=mysql
autostart=true
User=mysql
autorestart=unexpected
Numprocs=1
Redirect_stderr=true
startsecs=10
Stdout_logfile=/var/log/block_push.log
STDOUT_LOGFILE_MAXBYTES=1MB
stdout_logfile_backups=10
STDOUT_CAPTURE_MAXBYTES=1MB
Stderr_logfile=/var/log/block_push.log
STDERR_LOGFILE_MAXBYTES=1MB
stderr_logfile_backups=10
STDERR_CAPTURE_MAXBYTES=1MB
Final execution:
Supervisorctl Reload
[4]supervisor Use management: Implements an automatic restart of an abnormal interrupt subprocess (for example, MySQL)