I have this below config, my requirement is to route the requests if main-backend’s available servers becomes 1 out of 2, so I tried nbsrv, but ended up with some problem there which is not working as expected
frontend myApplication
bind :::443 ssl crt <cert/location>
log global
maxconn 10000
acl main_is_down nbsrv(main-backend) le 1
use_backend backup-backend if main_is_down
default_backend main-backend
backend main-backend
option httpchk GET /healthCheck
server server1 1.2.3.4:8080 maxconn 100 check
server server2 1.2.3.5:8080 maxconn 100 check
backend backup-backend
option httpchk GET /healthCheck
server backup-server1 2.1.3.4:8080 maxconn 100 check
server backup-server2 2.1.3.5:8080 maxconn 100 check
All the servers in main-backend is down, request is getting failed with 503 since both the servers in main-backend is down
Could you please help in suggesting the changes in this config to make it work so that I can forward the requests to backup-backend ?
I have a Fallback Setup with two single servers
frontend uses “use_backend master” for the requests, in backend there is a backup-setup.
backend master
server master 1.2.3.4:443 maxconn 140 check weight 1 inter 5s rise 3 fall 2
server slave 1.2.3.5:443 maxconn 100 check backup weight 1 inter 5s rise 3 fall 2
server slave only get connections if master does not answer some number of requests in a certain time.
if master is up again, all requests are routed to master again…
How this can work in production case? If we have more than one as main servers, haproxy will not route the traffic to backup until all the main are going down…
I need to route the traffic to backup if some number of main backend are down(2 are down out of 5), so I decided to go with nbsrv instead of using backup keyword in the same backend config