Created
July 27, 2025 22:32
-
-
Save Mitendra/69d1d378e0a17e3747947cc5b1f4cc1a to your computer and use it in GitHub Desktop.
HAProxy config showing static ip, dns slots, healthcheck, healthcheck with different frequency
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defaults | |
| mode http | |
| timeout connect 5s | |
| timeout client 30s | |
| timeout server 30s | |
| # Backend 1: Static IPs without health check | |
| backend backend1 | |
| balance roundrobin | |
| server static1 10.0.0.1:80 | |
| server static2 10.0.0.2:80 | |
| # Backend 2: Static IPs with health check | |
| backend backend2 | |
| balance roundrobin | |
| option httpchk | |
| server srv1 192.168.1.1:80 check | |
| server srv2 192.168.1.2:80 check | |
| # Backend 3: DNS-resolved slots without health check | |
| backend backend3 | |
| balance roundrobin | |
| server-template cache 5 cache.service.local:80 resolvers dns resolve-prefer ipv4 | |
| # Backend 4: DNS-resolved slots with health check | |
| backend backend4 | |
| balance roundrobin | |
| option httpchk | |
| server-template websrv 5 web.service.local:80 check resolvers dns resolve-prefer ipv4 | |
| # Backend 5: HTTP-specific health check | |
| backend backend5 | |
| balance roundrobin | |
| option httpchk | |
| # Servers with regular and down-check intervals | |
| server srv1 192.168.1.1:80 check inter 5s downinter 1s fall 2 rise 3 | |
| server srv2 192.168.1.2:80 check inter 5s downinter 1s fall 2 rise 3 | |
| server srv3 192.168.1.3:80 check inter 5s downinter 1s fall 2 rise 3 | |
| # DNS resolvers definition | |
| resolvers dns | |
| nameserver google 8.8.8.8:53 | |
| resolve_retries 3 | |
| timeout retry 2s | |
| hold valid 10s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment