The most common, basic configuration is that of a high-availability server which simply provides a single IP address (1.2.3.4) to be failed over between the nodes of our cluster. This is an ActivePassive configuration - the most basic configuration.
This is for Heartbeat 1.2.x
logfacility daemon # Log to syslog as facility "daemon" node paul silas # List our cluster members keepalive 1 # Send one heartbeat each second deadtime 10 # Declare nodes dead after 10 seconds bcast eth0 eth1 # Broadcast heartbeats on eth0 and eth1 interfaces ping 1.2.3.254 # Ping our router to monitor ethernet connectivity auto_failback no # Don't fail back to paul automatically respawn hacluster /usr/lib/heartbeat/ipfail # Failover on network failures
This is for Heartbeat 2.0.x without CRM
logfacility daemon keepalive 1 deadtime 10 warntime 5 initdead 120 # depend on your hardware udpport 694 ping 1.2.3.254 bcast eth0 auto_failback off node paul node silas respawn hacluster /usr/lib/heartbeat/ipfail use_logd yes
This is for Heartbeat 2.0.x with CRM
logfacility daemon keepalive 1 deadtime 10 warntime 5 initdead 120 # depend on your hardware udpport 694 ping 1.2.3.254 bcast eth0 auto_failback off node paul node silas use_logd yes compression bz2 compression_threshold 2 crm yes
See the ipfail page for more information on ipfail.
If you want less broadcast traffic, use ucast, which is strictly peer-to-peer. bcast is limited to the logical segment and not routed, while ucast/mcast are potentially routed. ucast duplicates the packets, as it has to be sent to each node and not just broad/multicasted to all of them at the same time.
For Heartbeat version 2 with CRM, you'll need to modify cib.xml instead of this file. Please see the Basic Single IP address Configuration for version 2 page for details.
paul 1.2.3.4
The first word (paul) on the line represents the "preferred" host for the service. The remainder of the line is the list of resources (services) which are part of this ResourceGroup. In this case, there is only one resource -- an IP address. This is a shorthand notation for IPaddr::1.2.3.4. There are many possible variants of how to specify the IP address, to learn about them, see the page on the IPaddr resource agent.
Note that this address cannot be used for anything else on these machines. In particular, it has to be controlled only by Heartbeat, and cannot be brought up by your operating system at boot time. We call this address a ServiceAddress - which is distinct from an AdministrativeAddress, like those brought up by your operating system.
/etc/ha.d/authkeys must be mode 600. See the section on GeneratingAuthkeysAutomatically for information how to generate good keys automatically.
auth 1 1 sha1 PutYourSuperSecretKeyHere
ha.cf, haresources, authkeys, AddressFailover, GettingStarted/TwoIPaddresses, A Basic Single IP address Configuration for version 2