others linux服务器运维 django3 监控 k8s golang 数据库 大数据 前端 devops 理论基础 java oracle 运维日志

qilinv10 麒麟v10 haproxy单机版 配置 代理doris

访问量:12 创建时间:2026-01-10

haproxy机器 192.168.72.140

doris FE机器信息

IP 端口
192.168.72.106 9030
192.168.72.113 9030
192.168.72.114 9030

安装haproxy

[root@localhost ~]# yum install haproxy
Last metadata expiration check: 0:24:59 ago on Sat 20 Dec 2025 04:53:59 PM CST.
Dependencies resolved.
===================================================================================================================================================
 Package                            Architecture                 Version                              Repository                              Size
===================================================================================================================================================
Installing:
 haproxy                            x86_64                       2.2.16-9.ky10                        ks10-adv-updates                       989 k
Installing dependencies:
 haproxy-help                       noarch                       2.2.16-9.ky10                        ks10-adv-updates                       913 k

Transaction Summary
===================================================================================================================================================
Install  2 Packages

Total download size: 1.9 M
Installed size: 5.7 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): haproxy-help-2.2.16-9.ky10.noarch.rpm                                                                       1.1 MB/s | 913 kB     00:00    
(2/2): haproxy-2.2.16-9.ky10.x86_64.rpm                                                                            1.1 MB/s | 989 kB     00:00    
---------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                              2.2 MB/s | 1.9 MB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                           1/1 
  Installing       : haproxy-help-2.2.16-9.ky10.noarch                                                                                         1/2 
  Running scriptlet: haproxy-2.2.16-9.ky10.x86_64                                                                                              2/2 
  Installing       : haproxy-2.2.16-9.ky10.x86_64                                                                                              2/2 
  Running scriptlet: haproxy-2.2.16-9.ky10.x86_64                                                                                              2/2 
  Verifying        : haproxy-2.2.16-9.ky10.x86_64                                                                                              1/2 
  Verifying        : haproxy-help-2.2.16-9.ky10.noarch                                                                                         2/2 

Installed:
  haproxy-2.2.16-9.ky10.x86_64                                          haproxy-help-2.2.16-9.ky10.noarch                                         

Complete!

修改配置文件

###注意timeout 设置过小会连接频繁断开。导致客户端请求异常
[root@localhost ~]# vim /etc/haproxy/haproxy.cfg
global
    maxconn         4000
    log         127.0.0.1 local2
    chroot          /var/lib/haproxy
    daemon
    ulimit-n        20480
    group           haproxy
    user            haproxy

defaults
    mode                    http
    log                     global
    option                  dontlognull
    option http-server-close
    option                  redispatch
    retries                 3
    timeout http-request    10s
    timeout queue           1m
    timeout connect         5000s
    timeout client          5000s
    timeout server          5000s
    timeout http-keep-alive 10s
    timeout check           2000s
    maxconn                 3000

frontend agent-front
    bind *:6030
    mode tcp
    default_backend forward-fe

backend forward-fe
    mode tcp
    balance roundrobin
    server fe-1 192.168.72.106:9030 weight 1  maxconn 2000 check inter 3000 rise 2 fall 3
    server fe-2 192.168.72.113:9030 weight 1  maxconn 2000 check inter 3000 rise 2 fall 3
    server fe-3 192.168.72.114:9030 weight 1  maxconn 2000 check inter 3000 rise 2 fall 3


[root@localhost ~]# systemctl start haproxy
[root@localhost ~]# systemctl enable haproxy
[root@localhost ~]# ss -tunlp | grep 6030
[root@localhost ~]# yum install mariadb
###通过haproxy代理端口登录doris
[root@localhost ~]# mysql -uadmin -P6030 -h192.168.72.140 -padmin@123

haproxy 开启stat监控页面

######修改文件/etc/haproxy/haproxy.cfg ,增加下面的内容
[root@localhost ~]# vim /etc/haproxy/haproxy.cfg
global
    maxconn         4000
    log         127.0.0.1 local2
    chroot          /var/lib/haproxy
    daemon
    ulimit-n        20480
    group           haproxy
    user            haproxy

defaults
    mode                    http
    log                     global
    option                  dontlognull
    option http-server-close
    option                  redispatch
    retries                 3
    timeout http-request    10s
    timeout queue           1m
    timeout connect         5000s
    timeout client          5000s
    timeout server          5000s
    timeout http-keep-alive 10s
    timeout check           2000s
    maxconn                 3000

listen status_page
    bind *:8888
    stats enable
    stats uri /haproxy-status
    stats auth    admin:admin@123
    stats realm "Welcome to the haproxy"

frontend agent-front
    bind *:6030
    mode tcp
    default_backend forward-fe

backend forward-fe
    mode tcp
    balance roundrobin
    server fe-1 192.168.72.106:9030 weight 1  maxconn 2000 check inter 3000 rise 2 fall 3
    server fe-2 192.168.72.113:9030 weight 1  maxconn 2000 check inter 3000 rise 2 fall 3
    server fe-3 192.168.72.114:9030 weight 1  maxconn 2000 check inter 3000 rise 2 fall 3

[root@localhost ~]# systemctl restart haproxy

访问页面http://YOUR的haproxy服务器的IP地址:8888/haproxy-status 输入上面的账号密码

登陆评论: 使用GITHUB登陆