Hello,
I am a newbie trying to configure HAPRoxy to do load balancing with session affinity. I have adapted haproxy.cfg found here http://blog.haproxy.com/2011/07/04/maintain-affinity-based-on-ssl-session-id/ so it looks like this:
global
log 127.0.0.1 local2 chroot /var/lib/haproxy pidfile /var/run/haproxy.pid maxconn 4000 user haproxy group haproxy daemon # turn on stats unix socket stats socket /var/lib/haproxy/stats
defaults
mode http
log global
option httplog
option dontlognull
option http-server-close
# does not work in tcp mode – option forwardfor except 127.0.0.0/8
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn 6000
frontend main
bind *:9443
option tcplog
mode tcp
default_backend appbackend app
mode tcp
balance roundrobin
stick-table type binary len 32 size 60k expire 60m
acl clienthello req_ssl_hello_type 1
acl serverhello rep_ssl_hello_type 2# use tcp content accepts to detects ssl client and server hello. tcp-request inspect-delay 5s tcp-request content accept if clienthello
# no timeout on response inspect delay by default. tcp-response content accept if serverhello
# SSL session ID (SSLID) may be present on a client or server hello. # Its length is coded on 1 byte at offset 43 and its value starts # at offset 44. # Match and learn on request if client hello. stick on payload_lv(43,1) if clienthello # Learn on response if server hello. stick store-response payload_lv(43,1) if serverhello
server lanneluc-node1 lanneluc-node1.server.com:9443 check server lanneluc-node2 lanneluc-node2.server.com:9443 check server lanneluc-node3 lanneluc-node3.server.com:9443 check server lanneluc-node5 lanneluc-node5.server.com:9443 check
listen stats *:1936
stats uri /
stats admin if TRUE
stats enable
stats hide-version
stats auth root:clu8ter8
stats refresh 3s
I have couple of questions about this:
- Does this config look correct?
- What is the best way to verify that the session affinity actually works, using logging perhaps, or some other way?
Many thanks
Alex