如何配置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代理minio?

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

Load balancing
如何使用HAProxy配置LogStash集群?

1 基础知识 1.1 软件的介绍 – HAProxy是一款开源免费、快速、可靠的解决方案 …

Load balancing
如何用HAProxy代理GlusterFS?

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