0

I have three load balancer (LB1, LB2, LB3) and plan to use ring architecture for active-active setup, e.g.

LB1    LB2    LB3
IP1    IP2    IP3

Idea as below:

  1. If LB1 failed, IP1 will be floated to IP2
  2. If LB2 failed, IP2 will be floated to IP3
  3. If LB3 failed, IP3 will be floated to IP1

Is the above setup common? Any potential issue?

Or any better recommendation for a three nodes setup?

Howard
  • 2,005
  • 11
  • 47
  • 70
  • I think you mean "IP1 will be floated to LB2" and similarly for other IPs. Is that right? So, you will have a total of 3 VIPs and thus all three load balancers will be active. – Khaled Jan 22 '13 at 15:00
  • Yes, you are right. I am thinking if this active-active architecture is ok. – Howard Jan 23 '13 at 10:07

1 Answers1

1

The active-active scenario is possible using keepalived. You need to configure multiple vrrp_instances such as:

vrrp_sync_group G1 {   # must be before vrrp_instance declaration 
  group {
    vserver1
  }
  group {
    vserver2
  }
}

# The primary server 
vrrp_instance vserver1 {
    interface eth0
    state MASTER
    virtual_router_id 1
    priority 100
    advert_int 3
    authentication {
      auth_type PASS
      auth_pass mypass
    }
    virtual_ipaddress {
        VIP1/24   # default CIDR mask is /32 
    }
}

# The backup server
vrrp_instance vserver2 {
    interface eth0
    state backup
    virtual_router_id 2
    priority 50
    advert_int 3
    authentication {
      auth_type PASS
      auth_pass mypapas
    }
    virtual_ipaddress {
        VIP2/24   # default CIDR mask is /32 
    }
}

The important point to have similar config on the 2nd node, but with different state and priority. In the shown example, you need to change these lines to make the other node MASTER for VIP2 and BACKUP for VIP1. By default each machine will have its VIP and when a failure occurs both VIPs as assigned to the remaining machine.

Of course, it can be done similarly for 3 machines. You need to define three vrrp_instances instead of two.

Khaled
  • 35,688
  • 8
  • 69
  • 98
  • Thanks first, I see you need to specify the `VIP1/24`, what if I missed the CIDR mask? Seems also work? – Howard Jan 23 '13 at 11:35
  • @Howard: It is like any other IP configuration. You can choose whatever you need according to your subnet. – Khaled Jan 23 '13 at 12:19
  • Hi, we have tested both /24 and default (/32) also works, are there hidden reason the default is /32? Any benefit for example? Thx – Howard Feb 01 '13 at 02:39