RHEL / CentOS 6.x HA (High Availability)


Configuring a High Availability Cluster on CentOS 6.x

This guide creates a two node, high-availability cluster using Heartbeat on CentOS 6.x

Later we present information for Redhat (RHEL 6.x)

Assumptions in example

node1 to primary node with IP address 192.168.1.1

node2 to slave node with IP address 192.168.1.2

192.168.1.3 is the virtual IP address used to access our HA service (httpd).

 Steps

1. Install Heartbeat package

yum install heartbeat

2. Copy the Heartbeat config files to /etc/ha.d

cp /usr/share/doc/heartbeat-2.1.2/authkeys /etc/ha.d/
cp /usr/share/doc/heartbeat-2.1.2/ha.cf /etc/ha.d/
cp /usr/share/doc/heartbeat-2.1.2/haresources /etc/ha.d/

3. Configure Heartbeat

a) edit authkeys

vi /etc/ha.d/authkeys

b) add lines
auth 2
2 sha1 test-ha

c) change permission of authkeys file:

chmod 600 /etc/ha.d/authkeys

d) edit ha.cf

vi /etc/ha.d/ha.cf

e) add lines

logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 30
initdead 120
bcast eth0
udpport 694
auto_failback on
node node01
node node02

Note: Our example assumes eth0 is the network interface used

f) edit haresources 

Note: Haresource defines the services to highly enable. In our example httpd is highly available

vi /etc/ha.d/haresources

g) add line

node01 192.168.1.3 httpd

4. Copy the /etc/ha.d/ directory from node01 to node02

5. Configure httpd to listen on virtual interface

a) edit httpd config file

vi /etc/httpd/conf/httpd.conf

b) add line

Listen 192.168.1.3:80

6. Copy the /etc/httpd/conf/httpd.conf file to node02

scp /etc/httpd/conf/httpd.conf root@node02:/etc/httpd/conf/

7. Create the file index.html on both nodes (node01 & node02)

a) On node01

echo “node01 apache test server” > /var/www/html/index.html

b) On node02

echo “node02 apache test server” > /var/www/html/index.html

8. Start heartbeat on each server (node01 and node02)

/etc/init.d/heartbeat start

9. Open web-browser and type in the URL

http://192.168.1.3

Node01 should display

10. Stop Hearbeat on node01

/etc/init.d/heartbeat stop

11. Open web-browser and type in the URL

http://192.168.1.3

Node02 should display

Notes

Heartbeat will automatically create the 192.168.1.3 virtual network interface and start the httpd service.

IP addresses 192.168.1.1 and 192.168.1.2 are used by Heartbeat to validate availability.

 

RHEL 6.x Configuring and Managing the High Availability Add-On

Download (, Unknown)

Redhat Documentation

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Cluster_Administration/ch-overview-CA.html

 

Leave a comment