For the sample configuration we will have two nodes called ha01 and ha02, and we will service an IP address, that we will call the Virtual IP address (VIP), on an active / passive configuration. Both nodes will need to have name resolution configured either through DNS or the /etc/hosts file.
Heartbeat has 3 main configuration files. These are /etc/ha.d/authkeys, /etc/ha.d/ha.cf, /etc/ha.d/haresources for version 1 or /var/lib/heartbeat/crm/cib.xml for version 2. There is a third configuration file, /etc/logd.cf, which works in both kinds of configurations.
- On the first host, edit /etc/ha.d/authekys.
auth 1 1 md5 DesiredPassword
- Then, change the permissions of the file:
sudo chmod 600 /etc/ha.d/authkeys
- Then, create the /etc/logd.cf.
debugfile /var/log/ha-debug logfile /var/log/ha-log
- Then, we need to edit /etc/ha.d/ha.cf with the following:
use_logd on udpport 694 keepalive 2 warntime 15 deadtime 30 initdead 30 mcast eth0 22.214.171.124 694 1 0 node ha01 ha02 auto_failback off crm no
- Now, we need specify the service we are cluster. We do this in /etc/ha.d/haresources
- To finish, we copy all configuration files to the second node:
scp /etc/ha.d/authkeys ha02:~ scp /etc/ha.d/ha.cf ha02:~ scp /etc/ha.d/haresources ha02:~ scp /etc/logd.cf ha02:~
- And we need to move then to the corresponding directories in the second node.
sudo mv authkeys /etc/ha.d/ sudo mv ha.cf /etc/ha.d/ sudo mv haresources /etc/ha.d/ sudo mv logd.cf /etc/
- Finally, we start Heartbeat:
sudo /etc/init.d/heartbeat start