mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-14 23:44:41 +00:00
a7e76142a1
The default_backend did not work in TCP mode since there was no header state to assign the backend. This causes much trouble when configs are created by copy-paste. The solution was to fix the way the backend is assigned upon accept(). A wrong contimeout assignment was fixed too.
107 lines
2.1 KiB
INI
107 lines
2.1 KiB
INI
# This is a test configuration.
|
|
# It must load-balance across active servers. Check local apache logs to
|
|
# verify :
|
|
#
|
|
# tail /var/log/apache/access_log
|
|
|
|
|
|
global
|
|
maxconn 10000
|
|
|
|
defaults
|
|
log 127.0.0.1:514 local0
|
|
balance roundrobin
|
|
contimeout 3000
|
|
srvtimeout 20000
|
|
clitimeout 10000
|
|
option dontlognull
|
|
|
|
listen no_cookie
|
|
bind :8000
|
|
retries 2
|
|
redispatch
|
|
mode http
|
|
option httplog
|
|
balance roundrobin
|
|
server dead1 1.1.1.1:80
|
|
server good1 127.0.0.1:80
|
|
|
|
# this one sends the connection to dead1, retries, then to good1, assigns
|
|
# the cookie. Subsequent connection will try to s1 again and should try good1.
|
|
listen cookie
|
|
bind :8001
|
|
retries 2
|
|
redispatch
|
|
mode http
|
|
option httplog
|
|
cookie SRV insert indirect nocache
|
|
balance roundrobin
|
|
server dead1 1.1.1.1:80 cookie s1
|
|
server good1 127.0.0.1:80 cookie s1
|
|
|
|
# this one sends the connection to dead1, retries, then to good1, assigns
|
|
# the cookie. Subsequent connection will try to s1 again and will stick to it.
|
|
listen cookie_persist
|
|
bind :8002
|
|
retries 2
|
|
redispatch
|
|
option persist
|
|
mode http
|
|
option httplog
|
|
cookie SRV insert indirect nocache
|
|
balance roundrobin
|
|
server dead1 1.1.1.1:80 cookie s1
|
|
server good1 127.0.0.1:80 cookie s1
|
|
|
|
frontend frt_default_tcp
|
|
bind :8003
|
|
mode tcp
|
|
option httplog
|
|
default_backend bck_default_tcp
|
|
|
|
backend bck_default_tcp
|
|
mode tcp
|
|
option httplog
|
|
retries 2
|
|
redispatch
|
|
balance roundrobin
|
|
contimeout 1000
|
|
srvtimeout 25000
|
|
server dead1 1.1.1.1:80
|
|
server good1 127.0.0.1:80
|
|
|
|
frontend frt_default
|
|
bind :8004
|
|
mode http
|
|
option httplog
|
|
default_backend bck_default
|
|
|
|
backend bck_default
|
|
mode http
|
|
option httplog
|
|
retries 2
|
|
redispatch
|
|
balance roundrobin
|
|
contimeout 1000
|
|
srvtimeout 25000
|
|
server dead1 1.1.1.1:80
|
|
server good1 127.0.0.1:80
|
|
|
|
frontend frt_use_back
|
|
bind :8005
|
|
mode http
|
|
option httplog
|
|
use_backend bck_use_back if TRUE
|
|
|
|
backend bck_use_back
|
|
mode http
|
|
option httplog
|
|
retries 2
|
|
redispatch
|
|
balance roundrobin
|
|
contimeout 1000
|
|
srvtimeout 25000
|
|
server dead1 1.1.1.1:80
|
|
server good1 127.0.0.1:80
|
|
|