Heartbeat配置
HeartBeat
HeartBeat是 Linux-HA的高可用性集群软件,它的主要作用是:
•
•
安装在LoadBalancer 和Backup上,运行于active/standby模式。
当LoadBalancer 失效时,Backup自动激活,成为实际的LoadBalancer。
切换到active模式时,按顺序启动VirtualIP、IPVS和 Ldirectord。
切换到standby模式时,按顺序关闭Ldirectord、IPVS和 VirtualIP。
ldirectord
安装HeartBeat过程中,已经自动安装了Ldirectord,它的作用是:
•
监测RealServer,当 RealServer 失效时,把它从LoadBalancer 列表中
删除,恢复时重新添加。
HA两台服务器的设置完全一样
230 yum localinstall -y *
heartbeat-3.0.4-1.el6.x86_64.rpm heartbeat-libs-3.0.4-1.el6.x86_64.rpm
heartbeat-devel-3.0.4-1.el6.x86_64.rpm ldirectord-3.9.2-1.2.x86_64.rpm
235 cd /usr/share/doc/heartbeat-3.0.4/
237 cp authkeys ha.cf haresources /etc/ha.d/
240 vim ha.cf
debugfile/var/log/ha-debug
logfile/var/log/ha-log
logfacility local0
keepalive2
deadtime30
warntime10
initdead120
udpport694
bcast eth0 # Linux
auto_failbackon
watchdog/dev/watchdog
node mfs1.example.com
node mfs2.example.com
ping192.168.0.3
respawnhacluster /usr/lib64/heartbeat/ipfail
apiauthipfail gid=haclient uid=hacluster
241 modprobe softdag
247 echo "modprobe softdog" >> /etc/rc.local
254 vi authkeys
auth1
1crc
256 chmod 600 authkeys
261 vi haresources
mfs1.example.comIPaddr::192.168.0.73/24/eth0 httpd
262 vi /etc/hosts
192.168.0.31mfs2.example.com
274 cd /var/www/html/
276 echo 192.168.0.30 > index.html
282 /etc/init.d/heartbeat startd
然后就可以访http://192.168.0.73(虚拟ip即vip)