HAProxy+Keepalived实现高可用负载均衡(6)

[root@haproxy2 haproxy]# ip addr show 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:0c:29:ae:5c:b3 brd ff:ff:ff:ff:ff:ff inet 192.168.80.128/24 brd 192.168.80.255 scope global eth0 inet6 fe80::20c:29ff:feae:5cb3/64 scope link valid_lft forever preferred_lft forever 6: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000 link/ether 00:0c:29:ae:5c:a9 brd ff:ff:ff:ff:ff:ff inet 172.16.0.2/16 brd 172.16.255.255 scope global eth1 inet 192.168.80.201/32 scope global eth1 inet6 fe80::20c:29ff:feae:5ca9/64 scope link valid_lft forever preferred_lft forever

View Code

在后端的real server提供测试页面,测试的结果如下:

请求以.html结尾的文件,haproxy将请求代理至后端static组中的server处理:

HAProxy+Keepalived实现高可用负载均衡

HAProxy+Keepalived实现高可用负载均衡

请求以.php结尾的文件,haproxy将请求代理至后端dynamic组中server处理:

HAProxy+Keepalived实现高可用负载均衡

注意:本文在haproxy.cfg的配置文件中,将dynamic组中的server配置了基于cookie的session绑定,所以,用同一浏览器看不出负载均衡的效果来。换个浏览器再访问一次或者清空浏览器的cookie记录就能显示效果,如下图。

HAProxy+Keepalived实现高可用负载均衡

haproxy的统计页面输出效果:

HAProxy+Keepalived实现高可用负载均衡

       至此,实验完结,但是对于haproxy的两个节点,keepalived对于这两节点是怎么进行心跳检测,其工作原理是什么,此知识点比较模糊,求大神赐教。

Linux下HAProxy+Keepalived双机高可用方案 

Haproxy+Keepalived搭建Weblogic高可用负载均衡集群

Keepalived+HAProxy配置高可用负载均衡

CentOS 6.3下Haproxy+Keepalived+Apache配置笔记

Haproxy + KeepAlived 实现WEB群集 on CentOS 6

Haproxy+Keepalived构建高可用负载均衡

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/09691ce697b77a62741710e0f4790264.html