1
我正在爲我的tomcats配置haproxy,我有兩個後端組,第一個後端在循環方法中有兩個tomcat和服務請求,其他後端只有一個tomcat。現在我想如果請求發送到第二個返回並且它已關閉,請求應該重新分派到其他後端的服務器。我正在使用此配置。向haproxy中的默認服務器或其他服務器請求redispatch請求?
#---------------------------------------------------------------------
# Example configuration for a possible web application. See the
# full configuration options online.
#
# http://haproxy.1wt.eu/download/1.4/doc/configuration.txt
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global
log 127.0.0.1 local0
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
stats socket /var/run/haproxy.sock level admin
#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
mode http
log global
option httplog
option dontlognull
option http-server-close
option forwardfor except 127.0.0.0/8
retries 3
timeout http-request 600s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 15s
timeout check 5s
maxconn 2000
frontend nginx
bind *:5000
mode http
acl tomcat1 path_beg -i /dologin
acl tomcat2 path_beg -i /mobileapp
default_backend backend_tomcat1
use_backend backend_tomcat1 if tomcat1
use_backend backend_tomcat2 if tomcat2
backend backend_tomcat1
mode http
balance roundrobin
server tomcat01 X.X.X.X:8080 check inter 2000
server tomcat03 X.X.X.X:8080 check inter 2000
backend backend_tomcat2
mode http
option persist
option redispatch
server tomcat02 X.X.X.X:8080 check inter 2000
listen stats *:1936
stats enable
stats refresh 2s
stats uri/
stats hide-version
stats auth admin:admin
stats admin if TRUE
誰能幫助我,我在做什麼錯在這裏