Briefly, KeepAlived is a daemon that is able to provide failover capabilities to servers/services by binding virtual IP addresses to machines. In the event of failure, KeepAlived would reassign this virtual IP to another machine. This action is executed fast (less than 2 seconds) and automatically.
This is a very interesting daemon to be used in combination with HAProxy, for example. It would be possible to have a failovered load balancer. In the event of this load balancer failing, keepalived would switch to another that is up and running in such a clean and fast way that the clients would not notice.
Installation steps under Debian Etch
apt-get update apt-get install keepalived
The system will ask a couple of questions. I usually reply using the default values, then configure myself manually the daemon, by editing /etc/keepalived/keepalived.conf.
To make the virtual IP address bindable, you should add this line /etc/sysctl.conf:
sysctl -p net.ipv4.ip_nonlocal_bind = 1
It is convenient to alter the order when keepalived is being started upon restarts. We probably want to have it started at the end so all the services are already running by the time keepalive runs. To do that:
update-rc.d -f keepalived remove Removing any system startup links for /etc/init.d/keepalived ... /etc/rc0.d/K20keepalived /etc/rc1.d/K20keepalived /etc/rc2.d/S20keepalived /etc/rc3.d/S20keepalived /etc/rc4.d/S20keepalived /etc/rc5.d/S20keepalived /etc/rc6.d/K20keepalived update-rc.d keepalived defaults 90 Adding system startup for /etc/init.d/keepalived ... /etc/rc0.d/K90keepalived -> ../init.d/keepalived /etc/rc1.d/K90keepalived -> ../init.d/keepalived /etc/rc6.d/K90keepalived -> ../init.d/keepalived /etc/rc2.d/S90keepalived -> ../init.d/keepalived /etc/rc3.d/S90keepalived -> ../init.d/keepalived /etc/rc4.d/S90keepalived -> ../init.d/keepalived /etc/rc5.d/S90keepalived -> ../init.d/keepalived