Keepalived 超过 20个虚拟地址问题

最近在生产环境使用 lvs + keepalived 的过程中遇到一个问题就是我的 keepalived 配置文件中使用了超过 20 个虚拟地址,一超过 20 个的时候就发现 keepalived 出现问题,会随机逐步把超过的 IP 给踢出集群。

所以当时的问题就是:

  1. 为什么 keepalived 超过 20 个虚拟地址会有问题?
  2. 是不是我的配置导致的?

经过一番谷歌,查询到如下 Keepalived for more than 20 virtual addresses,题主和我遇到了相同的问题,

keepalived 有个分配给 vrrp_instance 最大的虚拟 IP 的限制,数量是 20。

解决办法就是使用 virtual_ipaddress_excluded,示例:

vrrp_instance VI_1 {
    interface eth0
    state MASTER
    virtual_router_id 51
    priority 101

    virtual_ipaddress {
        10.200.85.100
    }

    virtual_ipaddress_excluded {
        10.200.85.101
        . all the way to
        10.200.85.200
    }
}

virtual_ipaddress_excluded contains a list of IP addresses that keepalived will bring up and down on the server, however they are not included in the VRRP packet itself so they don't count towards the 20 IP address limit.

Keepalived 的详细介绍请点这里
Keepalived 的下载地址请点这里

猜你喜欢

转载自www.linuxidc.com/Linux/2015-06/118587.htm