network/keepalived: Added (HealthChecking for LVS & HA cluters)

Signed-off-by: dsomero <xgizzmo@slackbuilds.org>
This commit is contained in:
Nilton Moura 2010-09-09 10:48:20 -04:00 committed by dsomero
parent da87ad250c
commit 7d5ffabc4d
6 changed files with 254 additions and 0 deletions

15
network/keepalived/README Normal file
View file

@ -0,0 +1,15 @@
What is Keepalived ?
The main goal of the keepalived project is to add a strong & robust
keepalive facility to the Linux Virtual Server project. This project
is written in C with multilayer TCP/IP stack checks. Keepalived
implements a framework based on three family checks: Layer3, Layer4
& Layer5/7.
This framework gives the daemon the ability of checking a LVS server
pool states. When one of the server of the LVS server pool is down,
keepalived informs the linux kernel via a setsockopt call to remove
this server entrie from the LVS topology. In addition keepalived
implements an independent VRRPv2 stack to handle director failover.
So in short keepalived is a userspace daemon for LVS cluster nodes
healthchecks and LVS directors failover.

View file

@ -0,0 +1,23 @@
config() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
# If there's no config file by that name, mv it over:
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
# toss the redundant copy
rm $NEW
fi
# Otherwise, we leave the .new copy for the admin to consider...
}
if [ -e etc/rc.d/rc.keepalived ]; then
cp -a etc/rc.d/rc.keepalived etc/rc.d/rc.keepalived.new.incoming
cat etc/rc.d/rc.keepalived.new > etc/rc.d/rc.keepalived.new.incoming
mv etc/rc.d/rc.keepalived.new.incoming etc/rc.d/rc.keepalived.new
fi
config etc/keepalived/keepalived.new
config etc/keepalived/keepalived.conf.new
config etc/rc.d/rc.keepalived.new

View file

@ -0,0 +1,108 @@
#!/bin/sh
# Slackware build script for keepalived
# Copyright 2010 Nilton Moura, Rio de Janeiro, RJ, Brasil
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=keepalived
VERSION=${VERSION:-1.1.20}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i486 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--sysconfdir=/etc \
--mandir=/usr/man \
--docdir=/usr/doc/$PRGNAM-$VERSION \
--build=$ARCH-slackware-linux
make
make install DESTDIR=$PKG
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a \
AUTHOR ChangeLog CONTRIBUTORS COPYING INSTALL README TODO VERSION \
$PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
cp -a $PKG/etc/rc.d/init.d/keepalived $PKG/usr/doc/$PRGNAM-$VERSION/init.keepalived
mv $PKG/etc/sysconfig/keepalived $PKG/etc/keepalived/keepalived.new
mv $PKG/etc/keepalived/keepalived.conf $PKG/etc/keepalived/keepalived.conf.new
install -m755 $CWD/rc.$PRGNAM $PKG/etc/rc.d/rc.$PRGNAM.new
rm $PKG/etc/rc.d/init.d/keepalived
rmdir $PKG/etc/sysconfig
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

View file

@ -0,0 +1,10 @@
PRGNAM="keepalived"
VERSION="1.1.20"
HOMEPAGE="http://www.keepalived.org/"
DOWNLOAD="http://www.keepalived.org/software/keepalived-1.1.20.tar.gz"
MD5SUM="6c3065c94bb9e2187c4b5a80f6d8be31"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
MAINTAINER="Nilton Moura"
EMAIL="nmoura@nmoura.eti.br"
APPROVED="dsomero"

View file

@ -0,0 +1,79 @@
#!/bin/sh
#
# Startup script for the Keepalived daemon
#
# This is the modified version from the original for the
# Slackware. The only thing that differs from the original
# is the path of the Source configuration file. Before was
# /etc/sysconfig and now is /etc/keepalived, and the header
# for the update-rc.d of Debian was removed.
#
# The original file was copied to
# /usr/doc/keepalived-1.1.20/init.keepalived
#
# This version was modified by Nilton Moura, the author of
# the SlackBuild Script for keepalived.
# Source function library
. /etc/rc.d/init.d/functions
# Source configuration file (we set KEEPALIVED_OPTIONS there)
. /etc/keepalived/keepalived
RETVAL=0
prog="keepalived"
start() {
echo -n $"Starting $prog: "
daemon keepalived ${KEEPALIVED_OPTIONS}
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
}
stop() {
echo -n $"Stopping $prog: "
killproc keepalived
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
}
reload() {
echo -n $"Reloading $prog: "
killproc keepalived -1
RETVAL=$?
echo
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
stop
start
;;
condrestart)
if [ -f /var/lock/subsys/$prog ]; then
stop
start
fi
;;
status)
status keepalived
;;
*)
echo "Usage: $0 {start|stop|reload|restart|condrestart|status}"
exit 1
esac
exit $RETVAL

View file

@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|' on
# the right side marks the last column you can put a character in. You must make
# exactly 11 lines for the formatting to be correct. It's also customary to
# leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
keepalived: keepalived (HealthChecking for LVS & High-Availability)
keepalived:
keepalived: The main goal of the keepalived project is to add a strong &
keepalived: robust keepalive facility to the Linux Virtual Server project.
keepalived: Keepalived implements a framework based on three family checks:
keepalived: Layer3, Layer4 & Layer5/7.
keepalived:
keepalived: Homepage: http://www.keepalived.org/
keepalived:
keepalived:
keepalived: