Supervisor Process Manager
---------------------------
1. Installation dependencies
Yum Install Python-setuptools-devel
2. Installing Supervisor
Pip Install supervisor or Easy_install Supervisor
3. Build the configuration file
echo_supervisord_conf >/etc/supervisord.conf
Modify
[Unix_http_server]
File=/var/run/supervisor.sock
[Supervisord]
Logfile=/var/log/supervisord.log
Pidfile=/var/run/supervisord.pid
[Supervisorctl]
Serverurl=unix:///var/run/supervisor.sock
[include]
Files =/etc/supervisord.d/*.conf
4. Supervisord service startup script
#!/bin/sh
#
#/etc/init.d/supervisord
#
# Supervisor is a client/server system That
# allows their users to monitor and control a
# number of processes on unix-like operating
# systems.
#
# chkconfig:-+
# description:supervisor Server
# processname:supervisord
# Source init function S
./etc/rc.d/init.d/functions
prog= "Supervisord"
prefix= "/usr/local"
exec_prefix= "${prefix } "
prog_bin=" ${exec_prefix}/bin/supervisord "
pidfile="/var/run/$prog. pid "
Start ()
{
Echo-n $ "Starting $prog:"
# # #注意下面这一行一定得有-C/etc/supervisord.conf Otherwise the configuration file has not been modified at all!
Daemon $prog _bin-c/etc/supervisord.conf--pidfile $PIDFILE
Sleep 1
[-F $PIDFILE] && success $ "$PR og Startup "| | Failure $ "$prog startup"
Echo
}
Stop ()
{
If [-f $PIDFILE]
then
Echo-n $ ' shutting down $PR OG: "
[-F $PIDFILE] && Killproc $prog | | Success $ "$prog shutdown"
Echo
Else
Echo-n "$prog is not running"
Echo
Fi
}
Case "$" in
Start)
start
;;
Stop)
stop
;;
Status
Status $prog
;;
Restart)
Stop
start
;;
*)
Echo "Usage: $ {start|stop|restart|status}"
;;
Esac
5. Management Service Profile Example
#cat/etc/supervisord.d/kafka.conf
[Program:zookeeper]
Command=/data/elk/kafka/bin/zookeeper-server-start.sh/data/elk/kafka/config/zookeeper.properties
Autostart = True
Startsecs = 5
#user = root
Redirect_stderr = True
Stdout_logfile =/var/log/supervisord/zookeeper.log
[Program:kafka]
Command=/data/elk/kafka/bin/kafka-server-start.sh/data/elk/kafka/config/server.properties
Autostart = True
Startsecs = 5
#user = root
Redirect_stderr = True
Stdout_logfile =/var/log/supervisord/kafka.log
6. Supervisord Command-line administration tool
Supervisorctl Start Program
Supervisorctl Stop Program
Supervisorctl Restart Program
Supervisorctl Restart all
Supervisorctl status
Supervisorctl Reload
Bootstrap.system_call_filter:false
network.host:0.0.0.0
Discovery.zen.ping.unicast.hosts: ["127.0.0.1", "192.168.50.224"]
Node.max_local_storage_nodes:2
SUPERVIOSRD Process Management