Monday, January 11, 2016

Supervisor Install

Supervisor

Why Supervisor?

Supervisor is a client/server system that allows its users to control a number of processes on UNIX-like operating systems. It was inspired by the following:

Features
Simple
Centralized
Efficient
Extensible
Compatible
Proven

Installation: Cent OS / Ubuntu


Supervisor Installation Cent OS (3.1.3)

Server IP:       192.168.30.128
Server OS:        CentOS release 6.7
#yum install python-setuptools
#easy_install supervisor
#supervisord --version
#vi /etc/supervisord.conf

Create a config file

# echo_supervisord_conf > /etc/supervisord.conf
Running the service
#Touch /etc/rc.d/init.d/supervisord                                                                                                                           
Add below scrip to above file

#!/bin/bash

. /etc/init.d/functions

DAEMON=/usr/bin/supervisord
PIDFILE=/var/run/supervisord.pid

[ -x "$DAEMON" ] || exit 0

start() {
        echo -n "Starting supervisord: "
        if [ -f $PIDFILE ]; then
                PID=`cat $PIDFILE`
                echo supervisord already running: $PID
                exit 2;
        else
                daemon  $DAEMON --pidfile=$PIDFILE -c /etc/supervisord.conf
                RETVAL=$?
                echo
                [ $RETVAL -eq 0 ] && touch /var/lock/subsys/supervisord
                return $RETVAL
        fi

}

stop() {
        echo -n "Shutting down supervisord: "
        echo
        killproc -p $PIDFILE supervisord
        echo
        rm -f /var/lock/subsys/supervisord
        return 0
}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    status)
        status supervisord
        ;;
    restart)
        stop
        start
        ;;
    *)
        echo "Usage:  {start|stop|status|restart}"
        exit 1
        ;;
esac
exit $?

Allow executable permission to the /etc/rc.d/init.d/supervisord
#nano /etc/rc.d/init.d/supervisord
#chmod 755 /etc/rc.d/init.d/supervisord

Please uncomment below line from  : /etc/supervisord.conf



Add the below command to : /etc/rc.local
/etc/init.d/supervisord start




Creating process pools


Create pool
Group name: pool1
Programs: web4 / web5

vi /etc/supervisor/conf.d/pool1.conf

[group:pool1]
programs=web4,web5

[program:web4]
command=java -jar stability-1.0-SNAPSHOT-jar-with-dependencies.jar dev
directory=/opt/85
autostart=true
autorestart=true
startretries=3
stderr_logfile=/var/log/web4/web4.err.log
stdout_logfile=/var/log/web4/web4.out.log

[program:web5]
command=java -jar stability-1.0-SNAPSHOT-jar-with-dependencies.jar dev
directory=/opt/86
autostart=true
autorestart=true
startretries=3
stderr_logfile=/var/log/web5/web5.err.log
stdout_logfile=/var/log/web5/web5.out.log



After that restart the supervisord
# /etc/init.d/supervisord restart

How to stop, start or restart.
 
Supervisorctl
 
 
start <name>        Start a process
start <gname>:*     Start all processes in a group
start <name> <name> Start multiple processes or groups
start all       Start all processes
           

Web log in URL.



 


Superlance

Superlance is a set of additional plugins for Supervisor, that includes plugins for sending email or SMS alerts when a Supervisor process exists unexpectedly, for monitoring memory usage of Supervisor processes, and a few other useful monitoring and alerting utilities. You can also install it via EasyInstall:
$ easy_install superlance


Related Other product
1.      Circus




No comments:

Post a Comment

Comments System

Disqus Shortname