acassen / keepalived

Keepalived
https://www.keepalived.org
GNU General Public License v2.0
4k stars 737 forks source link

Having both IPs on the same node In Active-Active setup #414

Closed zerthimon closed 8 years ago

zerthimon commented 8 years ago

Trying to set 2 nodes with active IPs:

node1:

vrrp_instance vip1 {
    state MASTER
    interface em1
    virtual_router_id 1
    priority 300
    virtual_ipaddress {
        1.1.1.1
}

vrrp_instance vip2 {
    state BACKUP
    interface em1
    virtual_router_id 2
    priority 200
    virtual_ipaddress {
        2.2.2.2
}

node2:

vrrp_instance vip1 {
    state BACKUP
    interface em1
    virtual_router_id 1
    priority 200
    virtual_ipaddress {
        1.1.1.1
}

vrrp_instance vip2 {
    state MASTER
    interface em1
    virtual_router_id 2
    priority 300
    virtual_ipaddress {
        2.2.2.2
}

No matter how many nodes are up, all IPs end up on the same node. Is there a misconfiguration on my side ? I'd like to have all nodes keep "their own IP" when both nodes up, and have all IPS when the other node is down.

Edit:

# keepalived -v
Keepalived v1.2.23 (07/26,2016)

Copyright (C) 2001-2016 Alexandre Cassen, <acassen@gmail.com>

Build options: KRNL_2_6 WITH_LVS HAVE_IPVS_SYNCD WITH_VRRP HAVE_VRRP_VMAC WITHOUT_ADDR_GEN_MODE WITHOUT_SNMP WITHOUT_SNMP_KEEPALIVED WITHOUT_SNMP_CHECKER WITHOUT_SNMP_RFC WITHOUT_SNMP_RFCV2 WITHOUT_SNMP_RFCV3 LIBIPVS_USE_NL WITHOUT_LIBNL WITH_VRRP_AUTH WITH_SO_MARK WITHOUT_LIBIPTC WITHOUT_LIBIPSET WITHOUT_IPV4_DEVCONF WITHOUT_IF_H_LINK_H_COLLISION HAVE_LINUX_NET_IF_H_COLLISION HAVE_SOCK_NONBLOCK HAVE_SOCK_CLOEXEC HAVE_FIB_ROUTING NO_MEM_CHECK NO_MEM_CHECK_LOG
pqarmitage commented 8 years ago

The valid range of priorities is 1 to 255, and 255 has a special significance of address owner.

You should have error messages in your logs stating that the priority is not valid and it is being set to 100.

You are also missing a closing '}' at the end of each vrrp_instance block.

zerthimon commented 8 years ago

Thanks, I rewrote the configs as you suggested and it works! Closing