HAProxy dual config for contingency

THIS IS WHAT I NEED TO ACCOMPLISH…

On DDC_HA_PROXY_SERVER I want to have ddcnode1 and ddcnode2 in a roundrobin while having ftwnode1 as a backup. ONLY If ddcnode1 and ddcnode2 are down, then traffic will forward to ftwnode1.

On FTW_HA_PROXY_SERVER I want ftwnode1 to be the primary, with traffic forwarding to ddcnode1 and ddcnode2 (roundrobin), ONLY if ftwnode1 goes down.

DDC_HA_PROXY_SERVER

listen stats

*bind :9999

stats enable

stats hide-version

stats uri /stats

stats auth admin:admin

frontend webserver

*bind :80

default_backend appserver

backend appserver

balance uri

hash-type consistent

server ddcnode1 172.16.5.30:80 check observe layer7 maxconn 5000 id 1 weight 75

server ddcnode2 172.16.5.31:80 check observe layer7 maxconn 5000 id 2 weight 75

server ftwnode1 10.2.3.200:80 check observe layer7 maxconn 5000 id 3 weight 25

________________________________________________________________________________

FTW_HA_PROXY_SERVER

listen stats

*bind :9999

stats enable

stats hide-version

stats uri /stats

stats auth admin:admin

frontend webserver

*bind :80

default_backend appserver

backend appserver

balance uri

hash-type consistent

server ftwnode1 10.2.3.200:80 check observe layer7 maxconn 5000 id 3 weight 100

server ddcnode1 172.16.5.30:80 check observe layer7 maxconn 5000 id 1 weight 25

server ddcnode2 172.16.5.31:80 check observe layer7 maxconn 5000 id 2 weight 25

Drop the weight keyword and use backup directive instead.

Like this?

DDC_HA_PROXY_SERVER
server ddcnode1 172.16.5.30:80 check observe layer7 maxconn 5000 id 1 weight 75

server ddcnode2 172.16.5.31:80 check observe layer7 maxconn 5000 id 2 weight 75

server ftwnode1 10.2.3.200:80 check observe layer7 maxconn 5000 id 3 backup 100

FTW_HA_PROXY_SERVER
server ftwnode1 10.2.3.200:80 check observe layer7 maxconn 5000 id 3 weight 100

server ddcnode1 172.16.5.30:80 check observe layer7 maxconn 5000 id 1 backup 50

server ddcnode2 172.16.5.31:80 check observe layer7 maxconn 5000 id 2 backup 50

Yes, but there is no point in declaring the weight. Remove the weight from all servers.

so should i leave it as balance uri? or do i change it to roundrobin?

Whatever you like.

You have written you want to do roundrobin between the primary servers though so I don’t see why you would use balance uri?

Right, switched to RR on both servers.
on this one, there is no load balancing going on between the backup servers.
Should i instead, add the other server as the backup instead of the nodes? Would that allow traffic to pass to the server and be distributed appropriately?

FTW_HA_PROXY_SERVER
server ftwnode1 10.2.3.200:80 check observe layer7 maxconn 5000 id 3

server ddchaproxyserver 172.16.5.32:80 check observe layer7 maxconn 5000 id 4 backup

//server ddcnode1 172.16.5.30:80 check observe layer7 maxconn 5000 id 1 backup

//server ddcnode2 172.16.5.31:80 check observe layer7 maxconn 5000 id 2 backup

Yes, by default, only the first backup server is used, as per the documentation I linked above:

By default, only the first operational backup server is used, unless the “allbackups” option is set in the backend.

Is that what you mean? Because I’m not sure I understood your question, specifically I don’t understand the difference between servers and nodes.

When I refer to nodes, its just the appserver on the front end. I would like to use the “allbackups” function. would I use that instead of just “backup”? I’ve been looking everywhere for a more comprehensive guide to haproxy, but a lot of what I’ve seen is default configurations. even in the documentation, I don’t remember any material on backup servers.

option allbackup is an option (an additional configuration directive), that needs to be set in either in the default or the backend section, as per the documentation (May be used in sections).

The server configuration lines with the backup keyword remains as-is.