1

最近在生产环境使用 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.


yexiaobai
4.8k 声望875 粉丝

就是不告诉你 O(∩_∩)O哈哈~。


引用和评论

0 条评论