分类: LINUX
2008-11-03 22:40:13
上面的图由于只有一台Director,如果Director发生故障,就会产生单点故障,为了解决这个问题,我们引入了HA高可用的概念,主备Director安装Heartbeat软件包(heartbeat-
注意:如果用Heartbeat方式,第四层尽量不要使用NAT方式,因为NAT方式要设置Director的DIP为默认网关,如果用HA切换到备Director,默认网关也需要切换到备Direcotr的DIP。
设置步骤:
1, 安装包,解决包依赖问题
# rpm -ivh heartbeat-pils-
# rpm -ivh heartbeat-stonith-
# rpm -ivh heartbeat-
2, 设置主备Director的主机名
hostname node1.lipeng.com
hostname node2.lipeng.com
vim /etc/hosts
61.1.1.2 node1.lipeng.com
61.1.1.22 node2.lipeng.com
3,
# cp /usr/share/doc/heartbeat-
# cp /usr/share/doc/heartbeat-
# cp /usr/share/doc/heartbeat-
# chmod 600 /etc/ha.d/authkeys
4,vim /etc/ha.d/ha.cf
debugfile /var/log/ha-debug
logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 30
warntime 10
initdead 120
udpport 694
ucast eth0 61.1.1.22
auto_failback on
watchdog /dev/watchdog
node node1.lipeng.com
node node2.lipeng.com
ping 61.1.1.1
respawn hacluster /usr/lib/heartbeat/ipfail
5,vim /etc/ha.d/haresource
node1.lipeng.com IPaddr:: 61.1.1.22/24/eth0 ldirectord
6,vim /etc/ha.d/authkeys
auth 1
1 crc
#2 sha1 HI!
#3 md5 Hello!
7,复制文件到备用Director
scp ldirectord ha.cf haresource authkeys 61.1.1.22:/etc/ha.d
8,启动主备的heartbeat
service heartbeat start
测试
ipvsadm –L
停掉主Director的网卡,看备Director是否启动
ipdown eth0