基于session的具体配置:
global
log 127.0.0.1 local2
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4000
user haproxy
group haproxy
daemon
stats socket /var/lib/haproxy/stats
defaults
mode http
log global
option httplog
option dontlognull
option http-server-close
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 3000
frontend web
log 127.0.0.1 local3
bind :80,:443
default_backend webservers
backend webservers
option httpchk
cookie webcookie insert nocache
balance roundrobin
server s1 martin:80 check inter 3000 rise 2 fall 5 cookie s1
server s2 lucia:80 check inter 30000 rise 2 fall 5 cookie s2
listen stats
bind *:8009
stats enable
stats uri /haproxy?stats
stats auth admin:admin
stats hide-version
stats admin if TRUE
acl allow src 192.168.1.0/24
acl deny src 192.168.1.111
tcp-request content reject if deny
tcp-request content accept if allow
tcp-request content reject
负载均衡之HAProxy详解(2)
内容版权声明:除非注明,否则皆为本站原创文章。
转载注明出处:https://www.heiqu.com/dc617481c7ea12124bf06d13cc5389dd.html