Sunday, June 2, 2013

Installation and configuration Heartbeat on Linux

Hi All,
Recently I implement Heartbeat for high Availability and ha-proxy for load balancing for four exchange servers in my office.
So, I took two Linux nodes (ex- 192.168.0.2 and 192.168.0.3) as a front to balance four exchange nodes (ex- 192.168.0.4, 192.168.0.5, 192.168.0.6, 192.168.0.7). We need to balance loads for ports (25, 110,993,995,80,443,587). We got a floating ip 192.268.0.1.
First I configured Heartbeat for High Availability of Linux nodes.
Below are steps for configuration
A.Node details are as follows
Node1 :
IpAddress(eth0):192.168.0.2(To send heartbeat signals to other nodes)
Node2 :
IpAddress(eth0):192.168.0.3(To send heartbeat signals to other nodes)
Step1 : Install the following packages in the same order which is shown.
Step1(a) : Install the following packages on node1
#rpm -ivh heartbeat-2.1.2-2.i386.rpm
#rpm -ivh heartbeat-ldirectord-2.1.2-2.i386.rpm
#rpm -ivh heartbeat-pils-2.1.2-2.i386.rpm
#rpm -ivh heartbeat-stonith-2.1.2-2.i386.rpm

Step1(b) : Install the following packages on node2
#rpm -ivh heartbeat-2.1.2-2.i386.rpm
#rpm -ivh heartbeat-ldirectord-2.1.2-2.i386.rpm
#rpm -ivh heartbeat-pils-2.1.2-2.i386.rpm
#rpm -ivh heartbeat-stonith-2.1.2-2.i386.rpm
Step2 : By default the main configuration files (ha.cf, haresources and authkeys) are not present in /etc/ha.d/ folder we have to copy these three files from /usr/share/doc/heartbeat-2.1.2 to /etc/ha.d/
Step2(a) : Copy main configuration files from /usr/share/doc/heartbeat-2.1.2 to /etc/ha.d/ on node 1
#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/
#cp /usr/share/doc/heartbeat-2.1.2/authkeys /etc/ha.d/
Step2(b) : Copy main configuration files from /usr/share/doc/heartbeat-2.1.2 to /etc/ha.d/ on node 2
#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/
#cp /usr/share/doc/heartbeat-2.1.2/authkeys /etc/ha.d/
Step3 : Edit ha.cf file
Step3(a) : Edit ha.cf file as follows on node1
********************************************
debugfile /var/log/ha-debug
logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 25
warntime 10
initdead 50
udpport 694
bcast eth0
ucast eth0 192.168.0.2
auto_failback on
node station-x.example.com
node station-y.example.com
******************************
Step3(b) : Edit ha.cf file as follows on node2
*****************************
debugfile /var/log/ha-debug
logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 25
warntime 10
initdead 50
udpport 694
bcast eth0
ucast eth0 192.168.0.3
auto_failback on
node station-x.example.com
node station-y.example.com
********************************
Step4 : Edit haresources file
Step4(a) : Just specify below entry in last line of this file on node1
station-x.example.com 192.268.0.1
Step4(b) : Just specify below entry in last line of this file on node2
station-x.example.com 192.268.0.1
Step5 (a) : Edit authkeys file on node1
#vi /etc/ha.d/authkeys
auth 2
#1 crc
2 sha1 HI!
#3 md5 Hello!
Now save and exit the file
Step5 (b) : Edit authkeys file on node2
#vi /etc/ha.d/authkeys
auth 2
#1 crc
2 sha1 HI!
#3 md5 Hello!
Step6 : Edit /etc/hosts file to give entries of host-names for the nodes
Step6(a) : Edit /etc/hosts file on node1 as below
192.268.0.2 station-x.example.com station-x
192.168.0.3 station-y.example.com station-y
Step6(b) : Edit /etc/hosts file on node2 as below
192.268.0.2 station-x.example.com station-x
192.168.0.3 station-y.example.com station-y

Step7 : Start Heartbeat cluster
Step7(a) : Start heartbeat cluster on node1
#service heartbeat start
Step7(b) : Start heartbeat cluster on node2
#service heartbeat start

Note:
1)      If on starting Heartbeat you are getting hostname error, then please set proper hostname for both nodes
2)      Checking your Heartbeat cluster:
If your heartbeat cluster is running fine a Virtual Ethernet Interface is created on node1.
# ifconfig

eth0      Link encap:Ethernet  HWaddr 08:00:27:0B:31:59
          inet addr:192.168.0.2  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:25035 errors:0 dropped:0 overruns:0 frame:0
          TX packets:13080 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:7108268 (6.7 MiB)  TX bytes:11011415 (10.5 MiB)

eth0:0    Link encap:Ethernet  HWaddr 08:00:27:0B:31:59
          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

No comments:

Post a Comment

Renew k8s certificates

Check If certificate expires: amikum@~:03:06:54(⎈ |local-cluster:default):sudo kubeadm certs check-expiration CERTIFICATE                EXP...