Gentoo Heartbeat HOWTO Brian Jackson With heartbeat systems can detect if another system is down and take appropriate action (such as taking over the service that ran on the other system). This HOWTO covers the installation and configuration of heartbeat on a Gentoo system. 1.0 2004-12-28 Introduction
What is Heartbeat?

Heartbeat takes care of dead node detection, and service/resource migration. Heartbeat clusters can be ridiculously simple or complex. We will cover setting up a simple cluster. To learn more about heartbeat, and how to setup even more complex setups see the Linux-HA Website.

Getting Heartbeat to Work
Installation

I this HOWTO we are assuming that you have 2 nodes (cluster1 and cluster2) with ip addresses (192.168.0.1 and 192.168.0.2 respectively), and you will have one cluster ip (192.168.0.5).

To install heartbeat, just use emerge heartbeat:

# emerge heartbeat

This should complete without any problems, but if there are any report them via bugzilla.

Configuration

Edit ha.cf. You need at least the following settings:

bcast eth0
keepalive 2
warntime 10
deadtime 30
auto_failback off
node cluster1
node cluster2

if you are going to be using a serial cable as a heartbeat transport, add the following settings as well:

serial /dev/ttyS0
baud 19200

Now what do these settings mean?

bcastsend broadcast heartbeats on the devicekeepalivetime between heartbeats (in seconds)warntimetime before a warning is logged (in seconds)deadtimetime before a node is declared dead (in seconds), and recovery startsauto_failback on=resources are reclaimed by original node, off= resources are not reclaimed by original node nodeuname -n of each node (i.e. you should have multiple node settings)serialdevice connected to other machinebaudbaud rate of serial device connected to other node
Setting Description

Other possible settings are:

ucast send unicast heartbeats to the ip of the other machine on the device. Syntax: ucast [dev] [ip of other node] mcast use multicast to send heartbeats to other cluster members. Syntax: mcast [dev] [mcast group] [port] [ttl] [loop]
Setting Description

Now edit haresources.

haresources must be identical on all cluster nodes.

You only need the following line (edit nodenames/IP addresses accordingly):

cluster1 192.168.0.5

This will give you an IP that moves to cluster2 when cluster1 dies.

Configuring the AuthKeys

Edit the authkeys file and add the following two lines:

1 sha1 key-for-sha1-any-text-you-want
Starting HeartBeat
# /etc/init.d/heartbeat start
Testing HeartBeat

You can pull the plug on cluster1 to test failover, or you can just shutdown heartbeat on cluster1, and watch as your cluster ip migrates to the other node.

Resources
  • Getting Started with Linux-HA