HeartBeat

To set up Heartbeat/Clustering two nodes are mandatory. You will also need 2 "Public IPs" and 2 "Internal IPs"

There are 3 configuration files that will need to be created and configured.

    • authkeys (encrypted passphrase, This will be identical on both master and slave)

    • haresources (defines master, This will be identical on both master and slave)

    • ha.cf ( defines master,slave,internal IP,etc, This will be different on each server)

1. Get updates

    • sudo aptitude update

    • sudo aptitude safe-upgrade

2. Configure Private IP

    • vi /etc/network/interface

    • add eth1 with private ip info

    • /etc/init.d/networking restart

2. Install Heartbeat

    • sudo aptitude install heartbeat

3. Navigate to Heartbeat Directory and create "authkeys"

    • vi /etc/heartbeat/authkeys

      • auth 1

      • 1 sha1 yourpassphrasegoeshere

    • chmod 600 /etc/heartbeat/authkeys (must not be 'world' readable or else Heartbeat will fail)

4. Navigate to the Heartbeat Directory and create "haresources"

    • vi /etc/heartbeat/haresources

      • masterhostname 172.16.110.XX/24 (public IP)

5. Navigate to Heartbeat Directory and create "ha.cf" on the master and edit the following lines

logfacility daemon

keepalive 2

deadtime 15

warntime 5

initdead 120

udpport 694

ucast eth1 ##This is where your Slave Private IP goes##

auto_failback on

node master ##Hostname of Master##

node slave ##Hostname of Slave##

respawn hacluster /usr/lib/heartbeat/ipfail

use_logd yes

6. Restart heartbeat

    • /etc/init.d/heartbeat restart

7. Navigate to Heartbeat Directory and create "ha.cf" on the slave and edit the following lines

logfacility daemon

keepalive 2

deadtime 15

warntime 5

initdead 120

udpport 694

ucast eth1 ##This is where your Master Private IP goes##

auto_failback on

node master ##Hostname of Master##

node slave ##Hostname of Slave##

respawn hacluster /usr/lib/heartbeat/ipfail

use_logd yes

8. Restart heartbeat

    • /etc/init.d/heartbeat restart

9. On Slave Server ping Master Public IP

    • ping -c2 172.16.110.XX

10. Shutdown Master Server ( Slave should take over by this time)

    • Try pinging Master again, ping -c2 172.16.110.XX ( You should receive reply)