On Sat, Apr 13, 2013 at 07:50:13AM +0200, Marco Corte wrote:
> Il 13/04/2013 01:01, Vicky Perdana:
> >Hi,
> >
> >I am a newbie to haproxy and was wondering if someone can confirm that the 
> >following config is valid?  Effectively I would like to load balanced two 
> >servers on multiple ports.
> >
> ><snippet>
> >Listen mybackendLB
> >     bind 10.6.200.14:555,10.6.200.14:8009,10.6.200.14:443
> >     mode tcp
> >     balance roundrobin
> >     option httpchk "/test.html"
> >     server app1 192.168.0.20:555 check port 8008
> >     server app1 192.168.0.20:8009 check port 8008
> >     server app1 192.168.0.20:443 check port 8008
> >     server app2 192.168.0.21:555 check port 8008
> >     server app2 192.168.0.21:8009 check port 8008
> >     server app2 192.168.0.21:443 check port 8008
> ><snippet>
> 
> Hi,
> 
> It is not clear to me what you want to do... something similar to the 
> following?
> 
> haproxy:555 -> app1/2:555
> haproxy:8009 -> app1/2:8009
> haproxy:443 -> app1/2:443

I also think that was it, though the original config does not do that.

> Listen mybackendLB-555
>     bind 10.6.200.14:555
>     mode tcp
>     balance roundrobin
>     option httpchk "/test.html"
>     server app1 192.168.0.20:555 check port 8008
>     server app2 192.168.0.21:555 check port 8008
> 
> Listen mybackendLB-8009
>     bind 10.6.200.14:8009
>     mode tcp
>     balance roundrobin
>     option httpchk "/test.html"
>     server app1 192.168.0.20:8009 check port 8008
>     server app2 192.168.0.21:8009 check port 8008
> 
> Listen mybackendLB-443
>     bind 10.6.200.14:443
>     mode tcp
>     balance roundrobin
>     option httpchk "/test.html"
>     server app1 192.168.0.20:443 check port 8008
>     server app2 192.168.0.21:443 check port 8008
> 

You can do even simpler by not specifying ports then :

  Listen mybackendLB
     bind 10.6.200.14:443
     bind 10.6.200.14:555
     bind 10.6.200.14:8009
     mode tcp
     balance roundrobin
     option httpchk "/test.html"
     server app1 192.168.0.20 check port 8008
     server app2 192.168.0.21 check port 8008

Then haproxy will connect to the server on the same port it received
the connection on. It's rarely used but for such things it can be handy.

Willy


Reply via email to