High Availability and failover noob question


#1

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


#2

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.

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

defaults
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
bind 192.168.0.53:8080
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
bind 192.168.0.53:80

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

ACL

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

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

BACKEND_SERVER

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