Linux - HA (High Availability) su Centos - P. 1 - Configurare HearthBeat

I due server hanno due NIC:

Chiamiamo il nome host di ogni server www1 o www2 il dominio invece è instyle.locale

(1) www1.instyle.locale[eth0:192.168.100.21] [eth1:10.0.100.21]
(2) www2.instyle.locale[eth0:192.168.100.22] [eth1:10.0.100.22]


1) Yum -y install heartbeat


yum -y install heartbeat # reinstallarlo in caso di errori

2) vi /etc/ha.d/authkeys # creare il certificato

auth 1
1 crc

chmod 600 /etc/ha.d/authkeys

3) andare sul server 1

vi /etc/ha.d/ha.cf

crm on
# debug log

debugfile /var/log/ha-debug
# log file

logfile /var/log/ha-log
# the way of output to syslog

logfacility local0
# keepalive

keepalive 2
# deadtime

deadtime 30
# deadping

deadping 40
# warntime

warntime 10
# initdead

initdead 60
# port

udpport 694
# interface and IP address of another Host

ucast eth1 10.0.0.22
# auto failback

auto_failback on
# node name (the name of "uname -n")

node www1.instyle.locale
node www2.instyle.locale
respawn root /usr/lib/heartbeat/pingd -m 100 -d 5s -a default_ping_set

4) Configuriamo il server 2

vi /etc/ha.d/ha.cf


crm on
debugfile /var/log/ha-debug
logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 30
deadping 40
warntime 10
initdead 60
udpport 694
# interface and IP address of another Host

ucast eth1 10.0.0.21
auto_failback on
node www1.instyle.locale
node www2.instyle.locale
respawn root /usr/lib/heartbeat/pingd -m 100 -d 5s -a default_ping_set

5) Eseguire il seguente commando su entrambi i server:

/etc/init.d/heartbeat start

Starting High-Availability services:
[  OK  ]
[root@www1 ~]# 


Chkconfig heartbeat on

6) Eseguiamo il commando su entrambi i server, se il risultato è ok vuol dire che il servizio si è avviato correttamente:

crm_mon -i 3

Defaulting to one-shot mode
You need to have curses available at compile time to enable console mode

============
Last updated: Sun Jun 15 05:04:34 2008
Current DC: www2.instyle.locale (f8719a77-70b4-4e5f-851b-dafa7d65d3a2)
2 Nodes configured.
0 Resources configured.
============

Node: www2.instyle.locale (f8719a77-70b4-4e5f-851b-dafa7d65d3a2): online
Node: www1.instyle.locale (2bbd6408-ec01-4b8c-bb8e-207237af3a99): online