免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2365 | 回复: 4

请教:LVS可以故障倒换,但是不能负载均衡 [复制链接]

论坛徽章:
0
发表于 2016-03-23 16:38 |显示全部楼层
两台机器配置 keepalived和 ipvsadm,这两台机器同时做物理机做负载均衡。

测试时发现流量都走到了一台机器上,从多个测试机测试也一样。

实在不知道什么原因,请高人帮忙看看吧,谢谢了。

虚拟机上做的。

配置如下:

MASTER:

! Configuration File for keepalived

global_defs {
   router_id 98
}

vrrp_instance ltDNS {
    state MASTER
    interface eth0
    virtual_router_id 97
    priority 200
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 4099
    }
    virtual_ipaddress {
        192.168.1.97
    }
}

virtual_server 192.168.1.97 53 {
    delay_loop 1
    lb_algo wlc
    lb_kind DR
    persistence_timeout 1
    protocol TCP

    real_server 192.168.1.98 53 {
        weight 1
        TCP_CHECK {
            connect_timeout 1
            nb_get_retry 1
            delay_before_retry 1
            connect_port 53
        }
    }
    real_server 192.168.1.99 53 {
       weight 1
        TCP_CHECK {
            connect_timeout 1
            nb_get_retry 1
            delay_before_retry 1
            connect_port 53
        }
    }
}


BACKUP:
! Configuration File for keepalived

global_defs {
   router_id 99
}

vrrp_instance ltDNS {
    state BACKUP
    interface eth0
    virtual_router_id 97
    priority 100
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 4099
    }
    virtual_ipaddress {
        192.168.1.97
    }
}

virtual_server 192.168.1.97 53 {
    delay_loop 1
    lb_algo wlc
    lb_kind DR
    persistence_timeout 1
    protocol TCP

    real_server 192.168.1.98 53 {
        weight 1
        TCP_CHECK {
            connect_timeout 1
            nb_get_retry 1
            delay_before_retry 1
            connect_port 53
        }
    }
    real_server 192.168.1.99 53 {
        weight 1
        TCP_CHECK {
            connect_timeout 1
            nb_get_retry 1
            delay_before_retry 1
            connect_port 53
        }
    }
}

论坛徽章:
36
IT运维版块每日发帖之星
日期:2016-04-10 06:20:00IT运维版块每日发帖之星
日期:2016-04-16 06:20:0015-16赛季CBA联赛之广东
日期:2016-04-16 19:59:32IT运维版块每日发帖之星
日期:2016-04-18 06:20:00IT运维版块每日发帖之星
日期:2016-04-19 06:20:00每日论坛发贴之星
日期:2016-04-19 06:20:00IT运维版块每日发帖之星
日期:2016-04-25 06:20:00IT运维版块每日发帖之星
日期:2016-05-06 06:20:00IT运维版块每日发帖之星
日期:2016-05-08 06:20:00IT运维版块每日发帖之星
日期:2016-05-13 06:20:00IT运维版块每日发帖之星
日期:2016-05-28 06:20:00每日论坛发贴之星
日期:2016-05-28 06:20:00
发表于 2016-03-23 23:19 |显示全部楼层
回复 1# bjtzq

同时都做负载均衡? 你的是双主?


   

论坛徽章:
0
发表于 2016-03-24 11:23 |显示全部楼层
回复 2# Godbach

不是双主吧,是做VRRP热备的两台机器同时作为负载均衡的机器,也就是说这个LVS集群一共只有两台机器

   

论坛徽章:
36
IT运维版块每日发帖之星
日期:2016-04-10 06:20:00IT运维版块每日发帖之星
日期:2016-04-16 06:20:0015-16赛季CBA联赛之广东
日期:2016-04-16 19:59:32IT运维版块每日发帖之星
日期:2016-04-18 06:20:00IT运维版块每日发帖之星
日期:2016-04-19 06:20:00每日论坛发贴之星
日期:2016-04-19 06:20:00IT运维版块每日发帖之星
日期:2016-04-25 06:20:00IT运维版块每日发帖之星
日期:2016-05-06 06:20:00IT运维版块每日发帖之星
日期:2016-05-08 06:20:00IT运维版块每日发帖之星
日期:2016-05-13 06:20:00IT运维版块每日发帖之星
日期:2016-05-28 06:20:00每日论坛发贴之星
日期:2016-05-28 06:20:00
发表于 2016-03-25 10:19 |显示全部楼层
回复 3# bjtzq

主备模式,就是一台在工作,另外一台不工作。当 KeepAlive 发现其中一台 health check 失败了,才会把流量切到另外一台。


   

论坛徽章:
0
发表于 2016-03-28 10:46 |显示全部楼层
回复 4# Godbach

这个指的是VRRP的流量转向吧,我现在是两台VRRP网关同时配置做LVS的负载均衡,我是想不管哪个VRRP是主,这两台机器都负载均衡。

比如如果让两台机器做VRRP,另外几台机器做物理机来负载均衡,那么不管两台VRRP哪台可用,这些物理机都会负载均衡吧。

   
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP