haproxy 配置文件详解 之 listen

配置示例:

listen admin_stats
    bind 0.0.0.0:9188
    mode http
    log 127.0.0.1 local0 err
    stats refresh 30s
    stats uri /haproxy-status
    stats realm welcome login\ Haproxy
    stats auth admin:admin~!@
    stats hide-version
    stats admin if TRUE

这个部分通过listen 关键字定义了一个名为“admin_stats”的实例,其实就是定义了一个HAProxy 的监控页面,每个选项的含义如下:

stats refresh:设置HAProxy 监控统计页面自动刷新的时间。

stats uri:设置HAProxy 监控统计页面的URL 路径,可随意指定。例如,指定“statsuri /haproxy-status”,就可以通过http://IP:9188/haproxy-status 查看。

stats realm:设置登录HAProxy 统计页面时密码框上的文本提示信息。

stats auth:设置登录HAProxy 统计页面的用户名和密码。用户名和密码通过冒号分割。可为监控页面设置多个用户名和密码,每行一个。

stats hide-version:用来隐藏统计页面上HAProxy 的版本信息。

stats admin if TRUE:通过设置此选项,可以在监控页面上手工启用或禁用后端真实服务器,仅在haproxy1.4.9 以后版本有效。

猜你喜欢

转载自www.cnblogs.com/yyxianren/p/10943078.html