Search code examples
load-balancinghaproxy

Load Balance server HAProxy or alternative


I need load balance server. LB should listen multiple ports and forward to backend servers with the same ports. Logic for backed should be always send tcp requests to A server with same ports which is defined in LB server, and if A server is down forward to Server B.

Example:

LB port 10202  to Backend port 10202
LB port 10203  to Backend port 10203

Is it possible?


Solution

  • Unless I miss-understand then that sounds fairly simple. Just use a port range. Any port in the range is accepted and DONT specify the port on the backend i.e. keep the one you come in on:

    listen L7_HTTP
        bind 10.0.0.20:10202-10203
        server RS001 127.0.127.1 check
        server RS002 127.0.127.2 check