0
votes

I am using HAProxy for load balancing my application on RHEL7. I have two servers server1 and server2, of which I want server1 as prefered server. My requirement is: server1 should serve all requests by default; if server1 fails, server2 should be active; when server1 is up, server1 should become active and should process requests. Following is my frontend/backend in haproxy.conf:


frontend frontend_2143
    bind *:2143
    default_backend backend_2143


backend backend_2143
    balance roundrobin
    mode tcp
    server server1 192.160.0.3:2143 check weight 255
    server server2 192.160.0.4:2143 check

With this configuration I am receiving all my request at server1 at begining, and at server2 after server1 is down, but when server1 is up, the requests are still getting received at server2.

Can anyone help here?

1
Add the backup keyword to the configuration for server2. - Michael - sqlbot

1 Answers