zyp*_*pro 5 port config haproxy
我正在使用HAProxy 1.6.4并想要启用统计数据.(/ HAProxy的?数据)
这是我的cfg:
global
log 127.0.0.1 local2
daemon
maxconn 256
defaults
log global
timeout connect 5000
timeout client 10000
timeout server 10000
frontend http-in
bind *:8080
default_backend testb
backend testb
balance roundrobin
server s1 123.456.789.0:443 maxconn 32
server s2 123.456.789.1:443 maxconn 32
listen statistics
bind *:8080
mode http
stats enable
Run Code Online (Sandbox Code Playgroud)
如果我在8080以外的其他端口上运行统计信息它可以工作,但是我如何在与我的前端(8080)相同的端口上运行它,它在默认情况下运行mode tcp?
您可以通过重定向到自己并使用如下访问列表来做到这一点:
global
log 127.0.0.1 local2
daemon
maxconn 256
defaults
log global
timeout connect 5000
timeout client 10000
timeout server 10000
listen stats :1936
mode http
stats enable
stats hide-version
stats realm Haproxy\ Statistics
stats uri /
stats auth myUser:myPassword
frontend http-in
bind *:8080
acl is_www hdr_end(host) -i www.mysite.com
acl is_stat hdr_end(host) -i stat.mysite.com
use_backend srv_www if is_www
use_backend srv_stat if is_stat
backend srv_www
balance roundrobin
server s1 123.456.789.0:443 maxconn 32
server s2 123.456.789.1:443 maxconn 32
backend srv_stat
server Local 127.0.0.1:1936
Run Code Online (Sandbox Code Playgroud)
使用转到服务器时www,它将带您到Web服务器。但是,使用stat,它将您从输入端口重定向8080到1936正在运行的统计信息