0
mydomain.com
的反向代理正在工作,但子域fela.mydomain.com
似乎在172.17.0.59:8080
和172.17.0.50:8080
之间随机选取。haproxy反向代理指定随机
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
defaults
log global
mode http
option httplog
option dontlognull
timeout connect 5000
timeout client 10000
timeout server 10000
listen stats
# Uncomment "disabeled" below to disable the stats page :
# disabled
bind :1988
stats uri/
frontend http-in
bind *:80
# Define hosts
acl host_fela hdr(host) -i fela.mydomain.com
acl host_mydomain hdr(host) -i mydomain.com
## figure out which one to use
use_backend mydomain_cluster if host_mydomain
use_backend fela_cluster if host_fela
backend mydomain_cluster
balance leastconn
option httpclose
option forwardfor
cookie JSESSIONID prefix
server node1 172.17.0.50:8080 cookie A check
backend fela_cluster
balance leastconn
option httpclose
option forwardfor
cookie JSESSIONID prefix
server node1 172.17.0.59:8080 cookie A check