Reputation: 403
I have the below-mentioned scenario:
I have two domains let's say domain D1 & domain D2
Machines I have :
Machine M1LB that is for Load Balancer (HA Proxy)
Machine D1M1 & D1M2, that is for Application 1
Machine D2M1 & D2M2, that is for Application 2
Traffic of domain D1 should go on D1M1 & D1M2 machines with Load Balancer M1LB, Similarly for domain D2 should go on D2M1 & D2M2 machines.
Now, what is the best way to configure Load balancer with the help of only 1 machine?
Upvotes: 3
Views: 10960
Reputation: 1791
Define two backends, and route by domain in frontend like this:
frontend http-in
bind *:80
acl host_d1 hdr(host) -i d1.com
acl host_d2 hdr(host) -i d2.com
use_backend be_d1 if host_d1
use_backend be_d2 if host_d2
backend be_d1
server D1M1 10.0.0.1:8080
server D1M2 10.0.0.2:8080
backend be_d2
server D2M1 10.0.0.1:8080
server D2M2 10.0.0.2:8080
Upvotes: 6