-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathhaproxy.cfg
More file actions
41 lines (36 loc) · 887 Bytes
/
Copy pathhaproxy.cfg
File metadata and controls
41 lines (36 loc) · 887 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
global
log stdout format raw local0
maxconn 65536
daemon
defaults
log global
mode tcp
option tcplog
option dontlognull
timeout connect 5s
timeout client 120s
timeout server 120s
# HAProxy 监控统计页面
listen stats
bind *:8404
mode http
stats enable
stats uri /stats
stats realm HAProxy\ Statistics
stats auth admin:admin
stats refresh 5s
# MQTT 前端 - 对外暴露的 MQTT 端口
frontend mqtt_frontend
bind *:1883
mode tcp
option tcplog
default_backend mqtt_backend
# MQTT 后端 - 3 个 broker 实例负载均衡
backend mqtt_backend
mode tcp
balance leastconn
option tcp-check
default-server inter 3s downinter 1s rise 2 fall 3
server broker1 mqtt-broker-1:1883 check
server broker2 mqtt-broker-2:1883 check
server broker3 mqtt-broker-3:1883 check