Keepalived:
The main goal of the keepalived project is to add a strong & robust keepalive facility to theLinux 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 daemonthe 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 independentVRRPv2 stack to handle director failover. So in short keepalived is a userspace daemon for LVS cluster nodes healthchecks and LVS directors failover. Installation:
OS: Centos 5.6
ip:eth0 192.168.1.17 netmask 255.255.255.0
Gateway: 192.168.1.1
kernel version: 2.6.18-238.19.1.el5
1. Install some essential packages.
linuxdba --> yum install yum-utils
linuxdba --> yumdownloader --source kernel
linuxdba --> mkdir /usr/src/redhat
linuxdba --> rpm -ivh kernel-2.6.18-238.19.1.el5.src.rpm
linuxdba --> ln -s /usr/src/kernels/2.6.18-238.19.1.el5-i686/ /usr/src/linux/
linuxdba --> yum install kernel-devel openssl openssl-devel ipvsadm
linuxdba --> yum install gcc gcc-c++ make
linuxdba --> yum install libnl libnl-devel
2. Install keepalived.
linuxdba --> wget http://www.keepalived.org/software/keepalived-1.2.1.tar.gz
linuxdba --> tar xfv keepalived-1.2.1.tar.gz
linuxdba --> cd keepalived-1.2.1
linuxdba --> ./configure
linuxdba --> make
linuxdba --> make install
3. Configure the keepalived service.
linuxdba -->cp /usr/local/etc/rc.d/init.d/keepalived /etc/rc.d/init.d/
linuxdba -->cp /usr/local/etc/sysconfig/keepalived /etc/sysconfig/
linuxdba -->mkdir /etc/keepalived
linuxdba -->cp /usr/local/etc/keepalived/keepalived.conf /etc/keepalived/
linuxdba -->cp /usr/local/sbin/keepalived /usr/sbin/
4. Start keepalived service
linuxdba -->service keepalived start
Reference page:
http://keepalived.org/documentation.html
http://blog.iyunv.com/liuy5277/article/details/6747288