Chinaunix首页 | 论坛 | 博客
  • 博客访问: 99928
  • 博文数量: 26
  • 博客积分: 1410
  • 博客等级: 上尉
  • 技术积分: 295
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-06 01:47
文章分类

全部博文(26)

文章存档

2009年(7)

2008年(19)

我的朋友

分类: LINUX

2008-11-03 22:40:13

 页-4

 

上面的图由于只有一台Director,如果Director发生故障,就会产生单点故障,为了解决这个问题,我们引入了HA高可用的概念,主备Director安装Heartbeat软件包(heartbeat-2.0.8-3.el5.centos.i386.rpm),通过haresource资源文件来控制主备服务器对。

注意:如果用Heartbeat方式,第四层尽量不要使用NAT方式,因为NAT方式要设置DirectorDIP为默认网关,如果用HA切换到备Director,默认网关也需要切换到备DirecotrDIP

设置步骤:

1,  安装包,解决包依赖问题

# rpm -ivh heartbeat-pils-2.0.8-3.el5.centos.i386.rpm

# rpm -ivh heartbeat-stonith-2.0.8-3.el5.centos.i386.rpm

# rpm -ivh heartbeat-2.0.8-3.el5.centos.i386.rpm

 

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-2.0.8/authkeys /etc/ha.d/  (发送加密的心跳)

# cp /usr/share/doc/heartbeat-2.0.8/ha.cf /etc/ha.d/  (设置双方的心跳行为)

# cp /usr/share/doc/heartbeat-2.0.8/haresources /etc/ha.d/  (设置资源的切换)

# 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

 

 

阅读(374) | 评论(0) | 转发(0) |
0

上一篇:实例精解grep

下一篇:Linux集群(五)

给主人留下些什么吧!~~