by June 7, 2004 0 comments

In this article we are going to see how easy it is to configure a highly available failsafe cluster for any Linux service. For this we will use a software framework called Heartbeat which is available on the website, The best part of this software is that it is completely service independent and you can run any and every Linux service on top of it. The concept of this software is very simple. The master node of this Heartbeat cluster generates a broadcast of UDP packets (Heartbeat) over a fixed interval of time and if the other node is unable to find that broadcast it determines that the node is dead and takes over the service after a given interval of time. 

As we are creating a two-node failsafe cluster, the first prerequisite is that of having two machines: one to be the master node and the other to be the backup node. Now you need to name your machines. We set the fully qualified domain name of our master node as ‘’ and the name of the backup node as ‘backup.pcquest. net’. The other thing you have to get is a cross-wired Cat-5 cable and four network cards. Two of the network cards will connect both the nodes to your main network, while the other two will connect the nodes to each other with the cross-wired cable. This will be used for determining the Heartbeat. When you are ready with all the hardware settings, install the version of Linux that you prefer. In our case, we used RedHat Enterprise Linux Advance Server. 

Here, let’s assume some things. Let’s say, the IP address of your master node’s network card, which is connected to the other failsafe node with the cross-wire is (/dev/eth1) and for the other node it is And on the network cards, which are connected to the main network you can either take the IP address from the DHCP server or you can give the IP address manually. We gave (/dev/eth0) IP address to the master node and to the backup node. Now you will need to configure an alias for the network card of the master node, which is connected to the main network and give another IP address of the same network to the device. To do so, start the redhat-config-network applet and add a new LAN card. Here, when asked, select the same network card which is connected to your main network. This card will be given a device name, such as eth0:0. Assign an IP address to it such as This will be the IP address of your cluster server and your service will respond to it.

System administrators
Configure a highly available failsafe cluster for Linux services

Get your Heartbeat up
Installing this software is not difficult. Just copy the folder called HA from this month’s Xtreme DVD to your home directory and install the software one by one like this.

#cp HA ~ -rf
#rpm : ivh heartbeat-pils-1.2.1-1.i586.rpm
#rpm : ivh openssl0.9.7-0.9.7c-52922cl.i386.rpm
#rpm : ivh perl*.rpm
#rpm : ivh heartbeat-stonith-1.2.1-1.i586.rpm
#rpm : ivh heartbeat-1.2.1-1.i586.rpm

One more thing to know here is that you have to install all of these files on both the nodes of your HA (High Availability) cluster. 

Here, the second network device (eth0:0) is the alias of the main network device

Configuring the cluster
Configuring the cluster consists of modifying three files: /etc/, /etc/haresources and /etc/authkeys. But one thing that you have to keep a watch on is that the default files are copied by the rpms to /usr/ share/doc/packages/Heartbeat. So, you have to first copy all these files from here to /etc and after that start modifying them. The first file called consists of all the settings for your nodes. Now you have to modify the following tags in this file for both the machines.

First open the file form /etc and make the following changes: 

node master 
node backup
deadtime 30
warntime 10
bcast eth0 
auto_failback on

Leave the other options untouched. Next open haresources from /etc and provide the IP address as follows: IPaddr:: httpd smb

This file should be identical in both the machines. Here you will notice that only one line is added. In this line we are assigning the DNS name of the master node and the IP address of the cluster and the services, which will run over Heartbeat. This means that now your network will have a failsafe cluster of Apache and Samba running over (the IP allocated to the alias of the network card connected to the main network). 

5 cable combination
 A Pin#
   B Pin#
1 3
2 6
3 1
6 2
4 7
5 8
7 4
8 5

Finally, copy the file authkeys from the documents directory to the /etc directory in both the machines and you are done.
If you want to configure Heartbeat with more details and parameters then you can always read the comments in the same files before the tags.

Testing the cluster
Now comes the main part that of testing the cluster. Just shut down your master node and wait for 30 seconds. Then go to the backup node and run the ifconfig command. You will find that the alias eth0:0 is already created and the same IP
( is assigned to it. 

Note: In this article we haven’t discussed how to configure your individual services such as SMB and httpd. For more details on them you can read the article Setting up Network Services, page 56, PCQuest, March 2004. The only thing to keep in mind is that you need exactly the same configurations for all the services in both the nodes.

Anindya Roy

No Comments so far

Jump into a conversation

No Comments Yet!

You can be the one to start a conversation.