3

we have several backend farms (HTTP, FTP, etc), basically one farm for each customer, and I am about to rebuild our load balancing infrastructure, moving from Piranha to HAProxy.
Since we are using several different backend server farms, the Piranha config currently looks like this (example shows farm webserv01, 2nd farm webserv02 uses same config, but different virtual IP):

virtual webserv01 {
active = 1
address = 10.11.11.1 eth2:30
vip_nmask = 255.255.255.0
port = 80
send = "GET / HTTP/1.0\r\n\r\n"
expect = "HTTP"
use_regex = 0
load_monitor = none
scheduler = rr
protocol = tcp
timeout = 6
reentry = 15
quiesce_server = 0
server webserv01v {
address = 192.168.101.64
active = 1
port = 80
weight = 1
}
server webserv02v {
address = 192.168.102.64
active = 1
port = 80
weight = 1
}
server webserv05v {
address = 192.168.101.65
active = 1
port = 80
weight = 1
}
server webserv06v {
address = 192.168.102.65
active = 1
port = 80
weight = 1
}
}

(e.g., customer 1 has his own webserver farm using vIP 10.11.11.1:80, customer 2 has a farm using vIP 10.11.11.2:80). I am curious if 1 single HAProxy instance is capable of handling multiple farms of the same service using different unique vIP addresses.

Basic setup would look like this:
2 HAProxy instances (with failover)
4 HTTP backend farms (one for each customer)
2 FTP farms

To make things clearer, please find attached my concept HAProxy config example for 2 webserver farms. Notice the different virtual IPs:

#---------------------------------------------------------------------
# LB: VIRTUAL WEBSERVER POOL #01
#---------------------------------------------------------------------
frontend vWEB-LB-01
bind    10.11.11.1:80
mode    http
default_backend vWEB-Pool-01

backend vWEB-Pool-01
mode    http
balance roundrobin
server  webserv01v  192.168.101.64:80   check   weight 100  inter 1000
server  webserv02v  192.168.102.64:80   check   weight 100  inter 1000
server  webserv05v  192.168.101.65:80   check   weight 100  inter 1000
server  webserv06v  192.168.102.65:80   check   weight 100  inter 1000

#---------------------------------------------------------------------
# LB: VIRTUAL WEBSERVER POOL #02
#---------------------------------------------------------------------
frontend vWEB-LB-02
bind    10.11.11.2:80
mode    http
default_backend vWEB-Pool-02

backend vWEB-Pool-02
mode    http
balance roundrobin
server  webserv01v  192.168.101.75:80   check   weight 100  inter 1000
server  webserv02v  192.168.101.76:80   check   weight 100  inter 1000
server  webserv05v  192.168.101.68:80   check   weight 100  inter 1000
server  webserv06v  192.168.101.69:80   check   weight 100  inter 1000

Can HAProxy and/or keeoalived handle this the way it is shown? If yes, how would I approach this?

I would like to use keepalived for failover purposes between the 2 HAProxy instances and have them do the load balancing for the backend farms. Kinda confused right now about the multiple virtual IP addresses I need to use, any insight would be much appreciated!

Mosh Pit
  • 339
  • 2
  • 4
  • 13

1 Answers1

5

Yes, HAproxy will do that. You'll just need to configure keepalived with all of the virtual IPs that HAproxy will use. You can assign multiple IPs in the virtual_ipaddress block in keepalived.conf:

virtual_ipaddress {
        192.168.0.10
        192.168.0.11
        192.168.0.12
        192.168.0.13
        }
Jim G.
  • 2,607
  • 1
  • 18
  • 19