如何使用HAProxy配置LogStash集群?

Load balancing

1 基础知识

1.1 软件的介绍

– HAProxy是一款开源免费、快速、可靠的解决方案
– HAProxy是基于TCP和HTTP协议提供高可用、负载均衡和代理服务

1.2 软件的功能

– 负载均衡
– 高可用
– 代理服务

2 最佳实践

2.1 准备安装环境

2.1.1 系统的基本配置

负载均衡器,
HostName = haproxy01.cmdschool.org
OS = Oracle Linux 9.x x86_64
IPAddress = 192.168.0.98

LogStash集群,
HostName = logstash0[1-2].cmdschool.org
OS = Oracle Linux 9.x x86_64
IPAddress = 192.168.0.11[3-4]

2.1.2 准备HAProxy负载均衡器环境

如何安装部署HAProxy?


由于非本章重点,前端的HAProxy高可用和负载均衡个人建议使用任播(基于三层动态路由技术)实现。

如何部署任播负载均衡ospf动态路由节点?

2.1.3 准备Logstash环境

请参阅以下章节准备两台Logstash服务器,配置请保持一直即可,

如何部署带安全认证的Logstash?

2.2 配置HAProxy负载均衡器前端

In haproxy01,

2.2.1 修改代理配置

vim /etc/haproxy/conf.d/logstash.cmdschool.org_5044.cfg 

修改如下配置,

frontend ft_logstash
    bind 0.0.0.0:5044
    mode tcp
    timeout client 1m
    log global
    default_backend bk_logstash
backend bk_logstash
    mode tcp
    log global
    timeout server 1m
    timeout connect 5s
    server logstash01 192.168.0.113:5044 check
    server logstash02 192.168.0.114:5044 check

然后,你需要使用如下命令测试配置恩建,

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

2.2.2 重载服务使配置生效

systemctl reload haproxy

2.2.3 开放应用所需的服务端口

firewall-cmd --permanent --add-port 5044/tcp
firewall-cmd --reload
firewall-cmd --list-all

参阅文档
===================

参考配置文档
————–
http://www.postfix.org/BASIC_CONFIGURATION_README.html
http://www.postfix.org/STANDARD_CONFIGURATION_README.html
https://www.postfix.org/postconf.5.html

集群的话题
————-
https://groups.google.com/g/mailing.postfix.users/c/n4W0i5t6mVk
https://linux-cluster.redhat.narkive.com/rmKOhgkv/postfix-active-active-mail-cluster

负载均衡的实现
—————
https://discourse.haproxy.org/t/how-to-send-email-via-haproxy/3952/2
https://www.haproxy.com/blog/efficient-smtp-relay-infrastructure-with-postfix-and-load-balancers

没有评论

发表回复

Load balancing
如何用HAProxy代理GlusterFS?

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

Load balancing
如何用HAProxy代理sftp?

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

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

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