
Note
Pacemaker is the Project Successor of "Heartbeat Version 2".
If you are looking for documentation and information for the "Version 2" heartbeat, you should really be reading the Pacemaker home page at http://clusterlabs.org[1].
If you are stuck with Heartbeat 2.1.3 or Heartbeat 2.1.4, the best fitting Documentation is probably that for Pacemaker 0.6, which can also be found on the Pacemaker Documentation[2] page
Quoting the first paragraph from v2[3] (in this wiki):
The CRM is now maintained as an independent project called Pacemaker[1] and now has many new features including support for the OpenAIS[4] cluster stack.
Heartbeat 2.1.4 was the last release to contain the CRM or "Version 2 Resource Manager" and since then all development and maintenance is performed as part of the Pacemaker project and all CRM code has been removed from Heartbeat.
For more details on Pacemaker, including latest versions, installation details and documentation, please visit http://clusterlabs.org[1].
Contents
Let me preface this document by saying most of this is _not_ original work. My purpose for writing this document is just trying to contribute in some way to possibly help those who REALLY get things done. The "work" I am contributing is a revised version of the Getting Started[5] page by Rudy Pawul and bits and pieces from other HA v1/v2 documents into a document that can help novices get started on Heartbeat 2[3] without pestering the developers and to cut down on repeat and simple questions on the mailing list.
This document is a sort of quickstart into Heartbeat 2[3]. As I said, it contains lots of bits and pieces from other documents. The problem is that this could lead to out of sync documentation. Therefore, if something doesn't work or you just want to know more, go to GettingStartedV2[6].
The goal is to have one page that describes a simple Heartbeat 2 configuration, for people who are beginning with Heartbeat 2. English is not my first language, so feel free to correct any mistakes.
Your "cluster[7]" is established via a "heartbeat" between two or more computers (nodes[8]) generated by the software package of the same name[9].
The basic goal of the High Availability Linux project is to:
The most important features why to use Heartbeat 2:
Heartbeat v2 can monitor resources without using "mon[10]", "ldirectord[11]" or others
Node[8]: An Instance that runs an OS
Resource[12]: A service or facility you want to be highly-available
RA: Resource Agent[13]
CRM[14]:
What you need:
High Availibility as good as it gets:
Avoiding a single point of failure is the whole idea of the setup. This also means it is advised to use more than one communications method between the nodes. It is also advised not to use only Ethernet cables or one single type of media, because in that case the mediastack would be a single point of failure.
This quickstart will describe a full installation and configuration of Heartbeat 2 and some resources on Debian Unstable. It is a quickstart so we will configure a simple and common configuration. We will make an Apache 2 service highly available on a shared IP (Active/Passive[15]). The configuration will contain monitors and starting the resources will be done using a group. Completing this document should give you a basic understanding of Heartbeat 2.
For simplicity, we use only one media, an Ethernet cable between the hosts:
Heartbeat is available at:
You can build it from source:
tar -xvzf /path_to_downloaded_tarball/heartbeat-x.x.x ./ConfigureMe configure make && make install
or use the RPM or .deb binaries available. If you use Gentoo, you can simply emerge it.
I used the .deb binaries for Debian so I added the following line to /etc/apt/sources.list
deb http://ftp.belnet.be/debian/ unstable main contrib non-free
and then
apt-get update apt-get install heartbeat-2
Configuring Heartbeat v2 is a little more tricky than Heartbeat v1, but Heartbeat v2 can also be used with a Heartbeat v1 configuration. If you would like to try out the v1 configuration first, read this[5].
There are 3 files you need to configure - you have to create these files:
HA v1 |
HA v2 |
Purpose |
Notes |
/etc/ha.d/authkeys |
/etc/ha.d/authkeys |
authenticate the nodes |
the same in both versions |
/etc/ha.d/ha.cf |
/etc/ha.d/ha.cf |
general Heartbeat configuration |
HA v2: you have to define you want to use the CRM[14] |
/etc/ha.d/haresources |
/var/lib/heartbeat/crm/cib.xml |
configure the resources |
another world |
The authkeys[17] file is used to authenticate the members of the clusters. There are three types of authentication methods available:
In this example we are going to use md5. If you want to know more about authkeys, look at this document[17].
A sample of the /etc/ha.d/authkeys file could be:
auth 1 1 md5 key-for-md5-any-text-you-want
Whatever index you put after the keyword auth must be found below in the keys listed in the file. If you put "auth 4", then there must be a "4 signaturetype" line in the list below.
The file permissions MUST be safe so do:
chmod 600 /etc/ha.d/authkeys
#logfacility local7 #logfile /var/log/ha-log #debugfile /var/log/ha-debug use_logd on udpport 694 keepalive 1 # 1 second deadtime 10 initdead 80 bcast eth0 #serial /dev/ttyS0 #if you use serial #baud 19200 #if you use serial node linuxha1 linuxha2 crm yes auto_failback yes
Log and debug explained:
If the logging daemon is used, logfile[18]/debugfile[19]/logfacility[20] in this file are not meaningful any longer. You should check the config file for logging daemon (the default is /etc/logd.cf). Example in /usr/share/doc/heartbeat-2/ha_logd.cf.
If use_logd[21] is not used, all log messages will be written to log files directly. The logging daemon is started/stopped in heartbeat script.
use_logd |
Use the ha-logd, setting to "yes" recommended. |
logfacility |
Defines which syslog logging facility it should use for logging its messages. Ignored if use_logd is enabled. |
logfile |
All non-debug messages from Heartbeat will go into this file. Ignored if use_logd is enabled. |
debugfile |
Specifies the file Heartbeat will write debug messages to. Ignored if use_logd is enabled. |
Time & Network:
udpport |
Specifies which port Heartbeat will use for communication between nodes, default 694. |
keepalive |
Specifies the time between keepalive packets. |
deadtime |
Specifies how quickly Heartbeat should decide that a node in a cluster is dead. |
initdead |
Specifies how long to wait before a node is considered dead after things first come up (e.g. after reboot), to take into account bootup time and network initialization. |
bcast |
Specifies which interface(s) should be used to send keepalives on (if you want to use broadcasts). |
Note that mcast[22] and ucast[23] can be used in place of bcast if desired.
Other:
node |
Tells what machines are part of the cluster. |
crm |
Specifies whether Heartbeat should run v2-style. We set it to on |
Note: When you want to use a Heartbeat 1 setup set crm to off.
I want to know more about the ha.cf file[24]
/var/lib/heartbeat/crm/cib.xml: Basically this file specifies the services for the cluster and who the default owner is.
A simple example setup that explains a basic resource configuration can be found here: v2/Examples/Simple[25].
An example that explains some more advanced configuration is here: v2/Examples/Advanced[26].
And more advanced things are here: ClusterInformationBase/UserGuide[27].
You need to configure 2 things for our setup, these you can simply configure in the Apache config.
In Debian: /etc/apache2/apache2.conf
Define the IP that Apache has to listen to:
Listen 10.7.200.30:80
For the monitoring:
# Allow server status reports, with the URL of http://servername/server-status
# Change the ".your_domain.com" to match your domain to enable.
#
<Location /server-status>
SetHandler server-status
Order allow,deny
Allow from all
</Location>
If you want to use DRBD[28] instead of shared storage, then you need to configure it
We recommend that any resources agents you write be OCF resource agents[29].
Getting Started With Heartbeat Version 2[6]
| [1] | http://clusterlabs.org |
| [2] | http://clusterlabs.org/wiki/Documentation |
| [3] | http://www.linux-ha.org/v2 |
| [4] | http://openais.org |
| [5] | http://www.linux-ha.org/GettingStarted |
| [6] | http://www.linux-ha.org/GettingStartedV2 |
| [7] | http://en.wikipedia.org/wiki/Computer_cluster |
| [8] | http://www.linux-ha.org/ClusterNode |
| [9] | http://www.linux-ha.org/Heartbeat |
| [10] | http://www.kernel.org/software/mon/ |
| [11] | http://www.vergenet.net/linux/ldirectord/ |
| [12] | http://www.linux-ha.org/resource |
| [13] | http://www.linux-ha.org/ResourceAgent |
| [14] | http://www.linux-ha.org/ClusterResourceManager |
| [15] | http://www.linux-ha.org/ActivePassive |
| [16] | http://www.linux-ha.org/download |
| [17] | http://www.linux-ha.org/authkeys |
| [18] | http://www.linux-ha.org/ha.cf/LogfileDirective |
| [19] | http://www.linux-ha.org/ha.cf/DebugfileDirective |
| [20] | http://www.linux-ha.org/ha.cf/LogfacilityDirective |
| [21] | http://www.linux-ha.org/ha.cf/UseLogdDirective |
| [22] | http://www.linux-ha.org/ha.cf/McastDirective |
| [23] | http://www.linux-ha.org/ha.cf/UcastDirective |
| [24] | http://www.linux-ha.org/ha.cf |
| [25] | http://www.linux-ha.org/v2/Examples/Simple |
| [26] | http://www.linux-ha.org/v2/Examples/Advanced |
| [27] | http://www.linux-ha.org/ClusterInformationBase/UserGuide |
| [28] | http://www.linux-ha.org/DRBD |
| [29] | http://www.linux-ha.org/OCFResourceAgent |
This information provided courtesy of the Linux-HA project at http://linux-ha.org/