This howto is tailored for RHEL/CentOS 5 distributions but can be adapted to any other Linux/Unix distro.
Please note this how-to has been tested on te CentOS/RHEL 5 system with heartbeat 2.1.3-3.el5 package. In Hearbeat post 2.1.4 version releases, the software project has been reorganized and although this how-to should work on the latest packages, it has not been tested.
For this guide we will setup 2 physical load balancer servers in a Active-Standby configuration and will use just one ethernet interface (eth0) for the HA heartbeat and shared IP.
Make sure in your two LiteSpeed LoadBalancer servers all the listener config and any place in the config where a source IP is configurable, are set to “ANY”.
lslb1.mydomain.com 188.8.131.52 #host name (uname -n) of box one, this is primary Active lslb2.mydomain.com 184.108.40.206 #host name (uname -n) box two, this is the secondary Standby
Make sure you use the hostname (uname -n) on the boxes as they appear exactly.
lslb1 is deisgnated the primary Active so that when both servers are restarted, rebooted, or for whatever reason, light up at the exact same moment, only lslb1 will acquire the shared IP resouce.
Shared IP resource
220.127.116.11 #this is the IP that we need to share and do a HA on. At any single moment, only one box will have this ip.
#download/install hearbeat rpm yum install heartbeat #enable heartbeat service on startup chkconfig heartbeat on
Make sure you have the lslb init script in /etc/init.d and runnable via the command line “service lslb start”.
If you do not have “lslb” init file in /etc/init.d then install it:
#run the script that's in your lslb install directory to re-install the lslb init script if it does not exists /lslbinstall/admin/misc/rc-inst.sh
Please note that heartbeat will consider itself down if “/etc/init.d/lslb stop” or “/etc/init.d/lslb start” comands fail for whatever reason. It is recommend you modify the return codes in the start) and stop) section of the init files to always return good “ret=0” where applicable.
There are 3 Hearbeat files we need to edit/create.
auth 3 3 md5 myheartbeat_password
Change “myheartbeat_password” to a password you want heartbeat to use for communication between the nodes
lslb1.mydomain.com 18.104.22.168 lslb
List the primary Active server's hostname here and the shared IP resource. The last part of “lslb” tells heartbeat to run the script /etc/init.d/lslb with param “start” on resource acquisition and “stop” on resource dropping.
#heartbeat config autojoin none mcast eth0 22.214.171.124 694 1 0 bcast eth0 warntime 5 deadtime 10 initdead 15 keepalive 1 node lslb1.mydomain.com #again, make sure you use the exact hostname for each node node lslb2.mydomain.com #...
#start service service heartbeat start; #check messages tail -f /var/log/messages; #use this to see the ip address assigned to each server. Remember that the shared IP 126.96.36.199 should only show up #on one server at any moment. Test this by bring in each server down, taking down the heartbeat, taking down the #network cables, etc ip addr sh eth0