背景:
阅读新闻
LVS-DR+Heartbeat实现高可用负载均衡服务
[日期:2012-10-26] 来源:Linux社区 作者:zhangzhenzz [字体:]
可以看到ip资源在node1.a.com上
[root@node1 ha.d]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:C2:B2:80
inet addr:192.168.145.10 Bcast:192.168.145.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fec2:b280/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:8750 errors:0 dropped:0 overruns:0 frame:0
TX packets:5788 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6124592 (5.8 MiB) TX bytes:2939570 (2.8 MiB)
Interrupt:67 Base address:0x2000
eth0:0 Link encap:Ethernet HWaddr 00:0C:29:C2:B2:80
inet addr:192.168.145.101 Bcast:192.168.145.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:67 Base address:0x2000
eth1 Link encap:Ethernet HWaddr 00:0C:29:C2:B2:8A
inet addr:192.168.10.1 Bcast:192.168.10.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fec2:b28a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:97 errors:0 dropped:0 overruns:0 frame:0
TX packets:186 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:25706 (25.1 KiB) TX bytes:45553 (44.4 KiB)
Interrupt:67 Base address:0x2080
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:99 errors:0 dropped:0 overruns:0 frame:0
TX packets:99 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:9065 (8.8 KiB) TX bytes:9065 (8.8 KiB)
测试
刷新网页
当node1节点停止服务时
[root@node1 ha.d]# cd /usr/lib/heartbeat/
[root@node1 heartbeat]# ./hb_standby
2012/10/25_19:53:46 Going standby [all].
可以看到node2节点上的IP资源
[root@node2 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:F1:76:1E
inet addr:192.168.145.20 Bcast:192.168.145.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fef1:761e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4290 errors:0 dropped:0 overruns:0 frame:0
TX packets:2402 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2602734 (2.4 MiB) TX bytes:311906 (304.5 KiB)
Interrupt:67 Base address:0x2000
eth0:0 Link encap:Ethernet HWaddr 00:0C:29:F1:76:1E
inet addr:192.168.145.101 Bcast:192.168.145.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:67 Base address:0x2000
eth1 Link encap:Ethernet HWaddr 00:0C:29:F1:76:28
inet addr:192.168.10.2 Bcast:192.168.10.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fef1:7628/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:906 errors:0 dropped:0 overruns:0 frame:0
TX packets:885 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:226068 (220.7 KiB) TX bytes:217983 (212.8 KiB)
Interrupt:67 Base address:0x2080
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:135 errors:0 dropped:0 overruns:0 frame:0
TX packets:135 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:11459 (11.1 KiB) TX bytes:11459 (11.1 KiB)
[root@node2 ~]# ipvsadm -ln
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
TCP 192.168.145.101:80 rr
-> 192.168.145.100:80 Route 1 0 0
-> 192.168.145.200:80 Route 1 0 0
从上述实验可以看到通过heartbeat实现director的高可用性。即使其中一个停止服务。也可以访问网站。
Corosync+OpenAIS+Pacemaker+Web+DRBD实现高可用群集
本文评论 查看全部评论 (0)
尊重网上道德,遵守中华人民共和国的各项有关法律法规 承担一切因您的行为而直接或间接导致的民事或刑事法律责任 本站管理人员有权保留或删除其管辖留言中的任意内容 本站有权在网站内转载或引用您的评论 参与本评论即表明您已经阅读并接受上述条款
评论声明
最新资讯