HAProxy community

High Availability and failover noob question


we are using HAProxy running on a vm. Is it possible to have 2 copies one running as a hot spare in case the other goes down? Feel free to point me to a document on how to configure this if one exists


sheetzdw, I have the same setup using 2 HAP servers in front of web servers, one is active the other passive. If the active is rebooted everything goes to the secondary.

It only works with the hap ip address showing up on the web servers so I lose the real IP address which I have tried several times and never got to work. See config below, not sure it is 100% secure, but works.

log local0 notice
maxconn 4096
user haproxy
group haproxy
# turn on stats unix socket
stats socket /var/lib/haproxy/stats

log global
mode http
option httplog
option dontlognull
http-reuse always
option http-server-close
retries 3
option redispatch
timeout check 15s
timeout connect 15s
timeout client 15s
timeout server 15s

listen stats
mode http
log global
stats enable
stats auth admin:server123secret
stats hide-version
stats refresh 30s
stats show-node
stats uri /stats

frontend http-in

option httpclose
option forwardfor
option forwardfor except
reqadd X-Forwarded-Proto:\ http
reqadd FRONT_END_HTTP:\ on


acl is_server1.domain.com            hdr_end(host) -i server1.domain.com
acl is_server2.domain.com            hdr_end(host) -i server2.domain.com


use_backend server1.domain.com       if is_server1.domain.com
use_backend server2.domain.com       if is_server2.domain.com


backend server1.domain.com
     server domain weight 1 maxconn 50 check
backend server2.domain.com
    server server2 server2.domain.com:8040 weight 1 maxconn 50 check