码迷,mamicode.com
首页 > 其他好文 > 详细

LVS DR模式问题

时间:2016-04-20 15:15:23      阅读:621      评论:0      收藏:0      [点我收藏+]

标签:lvs dr centos7

环境:

    director:192.168.232.18:80(centos7)

    realserver1:192.168.232.30:80(centos7)

    realserver2:192.168.232.31:80(centos7)

    realserver3:192.168.232.6:80(centos6.7)

    client:192.168.232.101

    

    VIP:192.168.232.20:80


问题现象:

   1、在client上刷新访问http://192.168.232.20/ ,只能看到 realserver3的首页,负载均衡算法rr。

   2、client分别访问http://192.168.232.30/  ,http://192.168.232.31/ ,正常。

   3、三台realserver的Iptables,firewalld,selinux服务都关闭了。

   4、三台realserver的ARP抑制配置如下

#!/usr/bin/bash


ifconfig lo:0 192.168.232.20  netmask 255.255.255.255 up

echo "1" > /proc/sys/net/ipv4/conf/lo/arp_ignore

echo "2" > /proc/sys/net/ipv4/conf/lo/arp_announce

echo "1" > /proc/sys/net/ipv4/conf/all/arp_ignore

echo "2" > /proc/sys/net/ipv4/conf/all/arp_announce


    5、在director上watch -n 1 ipvsadm -L -n -c,结果如下:

Every 1.0s: ipvsadm -L -n -c                                                                                  Wed Apr 20 11:59:55 2016


IPVS connection entries

pro expire state       source             virtual            destination

TCP 00:52  SYN_RECV    192.168.232.101:36962 192.168.232.20:80  192.168.232.31:80

TCP 00:46  SYN_RECV    192.168.232.101:36945 192.168.232.20:80  192.168.232.30:80

TCP 00:41  SYN_RECV    192.168.232.101:36930 192.168.232.20:80  192.168.232.30:80

TCP 00:37  SYN_RECV    192.168.232.101:36920 192.168.232.20:80  192.168.232.31:80

TCP 01:43  FIN_WAIT    192.168.232.101:36937 192.168.232.20:80  192.168.232.6:80

TCP 01:42  FIN_WAIT    192.168.232.101:36934 192.168.232.20:80  192.168.232.6:80

TCP 01:40  FIN_WAIT    192.168.232.101:36928 192.168.232.20:80  192.168.232.6:80

TCP 01:49  FIN_WAIT    192.168.232.101:36955 192.168.232.20:80  192.168.232.6:80

TCP 00:59  SYN_RECV    192.168.232.101:36980 192.168.232.20:80  192.168.232.31:80

TCP 00:40  SYN_RECV    192.168.232.101:36926 192.168.232.20:80  192.168.232.31:80

TCP 00:35  SYN_RECV    192.168.232.101:36913 192.168.232.20:80  192.168.232.31:80

TCP 00:50  SYN_RECV    192.168.232.101:36957 192.168.232.20:80  192.168.232.30:80

TCP 00:49  SYN_RECV    192.168.232.101:36953 192.168.232.20:80  192.168.232.31:80

TCP 00:47  SYN_RECV    192.168.232.101:36947 192.168.232.20:80  192.168.232.31:80

TCP 01:41  FIN_WAIT    192.168.232.101:36931 192.168.232.20:80  192.168.232.6:80


原因:

centos6中apache默认监听所有IP的80端口,  centos7中apache默认监听 “接口ip:80”。由于director做负载调度时是给realserver vip的80端口,而centos7中apache默认只开放了接口ip的80端口。所以导致以上问题。

另外需要注意:director的virtual server ip不能用本机的接口IP。

LVS DR模式问题

标签:lvs dr centos7

原文地址:http://1011779.blog.51cto.com/1001779/1765722

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!