如果启用HAProxy状态监控,需要修改haproxy.cfg配置文件,启用stats enable
<span style="color:#2c2c2c;">listen webservers
bind *:80
</span><span style="color:#ff0000;"><strong>stats enable</strong></span><span style="color:#2c2c2c;">
frontend imgservers
bind *:8080
default_backend imgservs
backend imgservs</span>
然后重启HAProxy,在浏览器中访问172.16.2.1/haproxy?stats
haproxy的状态页面一般不允许别人随意查看,因此通过认证进行访问是必要的
<span style="color:#2c2c2c;">listen webservers
bind *:80
server node2.magedu.com 192.168.10.11:80 check
</span><span style="color:#ff0000;"><strong>stats enable #显示状态页面
stats hide-version #隐藏haproxy的版本号
stats realm HAProxy\ Stats #提示信息
stats auth admin:admin #登录状态页面的帐号和密码</strong></span><span style="color:#2c2c2c;">
frontend imgservers
bind *:8080
default_backend imgservs
backend imgservs</span>