Sample Header Ad - 728x90

Haproxy: replace any active failing server with backup

0 votes
1 answer
538 views
My haproxy configuration is like this:
backend my-liveBackend
    timeout connect 5s
    timeout server 600s
    mode http
        balance uri len 52
        server my-live-backend1 10.80.1.161:8080 check
        server my-live-backend2 10.80.1.162:8080 check
        server my-live-backend3 10.80.1.163:8080 check
        server my-live-backend4 10.80.1.164:8080 check
        server my-live-backend5 10.80.10.165:8080 check backup
        server my-live-backend6 10.80.10.166:8080 check backup
        server my-live-backend7 10.80.10.167:8080 check backup
        server my-live-backend8 10.80.10.168:8080 check backup
When a non-backup server fails, haproxy doesn't activate a backup server to replace it: enter image description here I understand that haproxy will only activate a backup if ALL non backup fail: https://cbonte.github.io/haproxy-dconv/1.8/configuration.html#5.2-backup > When "backup" is present on a server line, the server is only used in load balancing when all other non-backup servers are unavailable. We actually need a bunch of servers active (ideally 4) and some as backup when we do maintenance on the active ones. Is there an option that allows to do this? A bit like "I want at least 4 servers always active". I couldn't find anything in the documentation to do that. My expectation would be like this: - live1 UP - live2 DOWN - live3 UP - live4 UP - live5 BACKUP UP ACTIVE <<== replaces 2 while 2 is in maintenance - live6 BACKUP UP INACTIVE - live7 BACKUP UP INACTIVE - live8 BACKUP UP INACTIVE
Asked by Gui13 (168 rep)
Feb 10, 2021, 08:17 AM
Last activity: Feb 10, 2021, 12:41 PM