编辑haproxy.cfg 加上下面参数
listen admin_stats
stats enable
bind *:8080 //监听的ip端口号
mode http //开关
option httplog
log global
maxconn 10
stats refresh 30s //统计页面自动刷新时间
stats uri /admin //访问的uri ip:8080/admin
stats realm haproxy
stats auth admin:admin //认证用户名和密码
stats hide-version //隐藏HAProxy的版本号
stats admin if TRUE //管理界面,如果认证成功了,可通过webui管理节点
保存退出后
重起service haproxy restart
然后访问 http://ip:8080/admin 用户名:admin 密码:admin
页面详细参数解释
Queue
Cur: current queued requests //当前的队列请求数量
Max:max queued requests
Limit:
Session rate(每秒的连接回话)列表:
scur: current sessions
smax: max sessions
slim: sessions limit
Sessions
Total:
Max: //最大回话
Limit: //回话限制
Lbtot: total number of times a server was selected //选中一台服务器所用的总时间
Bytes
In: //网络的字节数输入总量
Out: //网络的字节数输出总量
Denied
Req: denied requests//拒绝请求量
Resp:denied responses //拒绝回应Errors
Req:request errors
Conn:connection errors
Resp: response errors (among which srv_abrt)
Warnings
Retr: retries (warning)Redis:redispatches (warning)
Server列表:
Status:状态,包括up(后端机活动)和down(后端机挂掉)两种状态
LastChk:
Wght: (weight) : 权重
Act: server is active (server), number of active servers (backend) //活动链接数量
Bck: server is backup (server), number of backup servers (backend) //backup:备份的服务器数量
Down:
Downtime: downtime: total downtime (in seconds)
Throttle: warm up status