如何配置HAProxy的状态统计页面?

Load balancing

1 前言

一个问题,一篇文章,一出故事。
笔者今天想通过http的web页面查看haproxy的服务器状态,于是整理此文。

2 最佳实践

2.1 环境信息

如何安装部署HAProxy?

2.2 配置状态页面

2.2.1 增加配置

vim /etc/haproxy/haproxy.cfg

加入如下配置,

#...
listen stats                         # Define a listen section called "stats"
  bind :8080                         # Listen on localhost:
  mode http
  stats enable                       # Enable stats page
  stats hide-version                 # Hide HAProxy version
  stats realm Haproxy\ Statistics    # Title text for popup window
  stats uri /stats                   # Stats URI
  stats auth admin:adminpwd          # Authentication credentials

配置创建后,建议你使用如下命令测试配置,

haproxy -c -f /etc/haproxy/conf.d

2.2.2 重载服务使配置生效

systemctl reload haproxy
没有评论

发表回复

Load balancing
如何实现HAProxy集群多节点私有配置?

1 前言 一个问题,一篇文章,一出故事。 笔者之前创建的HAProxy集群(基于3层路由,即任播技术 …

Load balancing
如何设置haproxy节点异常邮件通知?

1 前言 一个问题,一篇文章,一出故事。 笔者haproxy上代理的节点越来越多,因此被haprox …

Load balancing
如何用HAProxy代理minio?

1 前言 一个问题,一篇文章,一出故事。 笔者今天需要实现HAProxy代理minio,因此整理此文 …