首页 » Linux, 网络技术 » Heartbeat双机热备体验

Heartbeat双机热备体验

_r1_c1

先按照老师的来吧,先用下Heartbeat,LVS和keepalived到实验室再做吧。
实验拓扑图如下:

1.安装heartbeat,我这里用的yum,装了2遍,不知怎回事。
[root@s1 ~]# yum install heartbeat
2.把配置文件复制到/etc/ha.d
[root@s1 ~]# cd /usr/share/doc/heartbeat-2.1.3/
[root@s1 heartbeat-2.1.3]# cp ha.cf /etc/ha.d/
[root@s1 heartbeat-2.1.3]# cp authkeys /etc/ha.d/
[root@s1 heartbeat-2.1.3]# cp haresources /etc/ha.d/
3.查看本机的名字(提前改好)
[root@s1 heartbeat-2.1.3]# uname -n
s1.ncist.cn
4.编辑配置文件
[root@s1 heartbeat-2.1.3]# cd /etc/ha.d
[root@s1 ha.d]# vi ha.cf
logfile /var/log/ha-log
keepalive 2
deadtime 30
warntime 10
initdead 120
udpport 694
bcast   eth1
ucast eth1 192.168.0.20
node    s1.ncist.cn
node    s2.ncist.cn
ping 192.168.128.2

[root@s1 ha.d]# vi authkeys
auth 1
1 crc

[root@s1 ha.d]# vi haresources
s1.ncist.cn 192.168.128.5 httpd

5.编辑hosts文件
[root@s1 ha.d]# vi /etc/hosts

192.168.128.4 s2.ncist.cn
192.168.128.3 s1.ncist.cn

6.启动服务

[root@s1 ha.d]# chmod 600 authkeys
[root@s1 ha.d]# service heartbeat start

S2的配置基本一致,心跳检测改为192.168.0.10

OK,启动测试,
S1虚拟出来的网卡

eth0:0    Link encap:Ethernet  HWaddr 00:0C:29:1C:9A:9D
inet addr:192.168.128.5  Bcast:192.168.128.255

S1关掉,S2自动接替,由于用虚拟机做的效果不好,改天实验室真机实验。

参考资料:http://0451861.blog.51cto.com/133006/130900

, ,

目前这篇文章有3条评论(Rss)

  1. admin | #1
    November 8, 2009 at 4:37 pm

    以前记着龙神做双机热备时天天拔网线玩,现在轮到我了~·~

  2. AugustaSHARP18 | #2
    July 22, 2011 at 3:25 am

    It’s perfect that people can take the personal loans and this opens up new chances.

  3. buy essays | #3
    December 5, 2011 at 5:02 pm

    I treat my future career very seriously and I buy custom essay, just because of this.

我要评论

icon_wink.gif icon_neutral.gif icon_mad.gif icon_twisted.gif icon_smile.gif icon_eek.gif icon_sad.gif icon_rolleyes.gif icon_razz.gif icon_redface.gif icon_surprised.gif icon_mrgreen.gif icon_lol.gif icon_idea.gif icon_biggrin.gif icon_evil.gif icon_cry.gif icon_cool.gif icon_arrow.gif icon_confused.gif icon_question.gif icon_exclaim.gif 

*
请输入图片中的字符以验证你并非垃圾机器人. 点击图片收听验证码的语音版.
点击这里收听此验证码的语音版本