Install Hearbeat-2
PHP Code:
aptitude update ; aptitude install heartbeat-2
or from backports (it's better):
PHP Code:
aptitude -t lenny-backports install heartbeat-2 heartbeat-2-gui
Create backup of HA configs, before start with configuring
PHP Code:
cp -r /etc/ha.d /opt/

Edit hosts
PHP Code:
127.0.0.1 localhost
192.168.1.101 node1
192.168.1.102 node2
Create authentication keys
PHP Code:
vim /etc/ha.d/authkeys

Several types are available:
crc,
sha1 and
md5
crc is a method without authentication,
insecure you should use it only in very secury vlans/networks or if you use a cross-over cable.
Example 1:
Example 2:
PHP Code:
auth 1
1 sha1 ThisIsAVeryLongAndBoringPasswordAndMaybeSecure
Example 3:
PHP Code:
auth 1
1 md5 ThisIsAVeryLongAndBoringPasswordAndMaybeSecure
finally set right permissions:
PHP Code:
chmod 600 /etc/ha.d/authkeys

copy config to node2
PHP Code:
scp /etc/ha.d/authkeys node2:/etc/ha.d/authkeys
ha.cf
PHP Code:
vim /etc/ha.d/ha.cf
PHP Code:
# Configuration for Heart-Beat 2
# <info@idrobot.net>
# Use heartbeat version 2
crm on
# Use device eth0 to broadcast the heartbea
bcast eth0
# Node hostnames - output of uname -n
node fw1
node fw2
# Logfile
logfile /var/log/ha-log
# Ping Gateway
ping 192.168.2.1
ping 192.168.2.13
# Which port Heartbeat will use for its UDP intra-cluster communication
udpport 694
# keepalive: how long between heartbeats?
keepalive 1
# deadtime: how long-to-declare-host-dead?
deadtime 5
# warntime: how long before issuing "late heartbeat" warning?
warntime 3
# Very first dead time (initdead)
initdead 10
Ensure they see each other:
Output:
PHP Code:
root@node1:~$ crmadmin -N
normal node: node2 (bd76d0d7-fd2e-4a08-8dfe-7a704f5db5e0)
normal node: node1 (7cfa2f8d-406a-40fe-98d5-6663807990df)

Copy config no node2
PHP Code:
scp /etc/ha.d/ha.cf node2:/etc/ha.d/ha.cf
Show running CIB:
-Q Query
-l Local
Location of CIB config-file:
PHP Code:
less /var/lib/heartbeat/crm/cib.xml

Clean ressource
PHP Code:
crm_resource -C -r bind9-child:0 -H fw2
-C Clean
-r Ressource
-H Host
Graphical-GUI for Heartbeat
PHP Code:
aptitude update ; aptitude install heartbeat-2-gui
To be able to log on you need to set a password for hacluster user:
PHP Code:
node1:~# passwd hacluster
node2:~# passwd hacluster
Or you can add another user (user=id) to hacluster group:
PHP Code:
usermod -G haclient id