Install Heartbeat HA cluster on Centos

So the backbone of my webcluster i use Heartbeat to monitor the server performance.
Heartbeat is setup to monitor the servers and to take actions if anything happens with some of the nodes.
This guide is for migraing and ip addres from one node to the secondary of the first node goes down.

Then i configure the other servers like apache ore mysql ontop.

First begin to enabling EPEL repos.

rpm -Uvh

Install heartbeat

yum install heartbeat

Setup so your host fiile is ok web1 web2

Create the file /etc/ha.d/ and ad the following in it

keepalive 2
deadtime 30
bcast eth0
node web1 web2

Create the file vi /etc/ha.d/haresources and ad the following into it

web1 IPaddr::


The ip is the ip that will first be in web1. If web1 goes down the ip will be transfer to web2 that will take over the reqest.

Create the file vi /etc/ha.d/authkeys and fill it with (alter the password)

auth 3
3 md5 password6asd567hajksdhjkhkjjkahdsk

Setting correct chmod to authkeys

chmod 600 /etc/ha.d/authkeys

Copy the config files to your heartbeat nodes. And then restart you heartbeat service

/etc/init.d/heartbeat restart

And run an ifconfig to se where your ip is


And thats it. Now when you first node is down the ip will come up at your secondary server.