-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhaproxy.cfg
64 lines (60 loc) · 1.95 KB
/
haproxy.cfg
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
global
ulimit-n 400011
maxconn 99999
maxpipes 99999
tune.maxaccept 500
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
chroot /var/lib/haproxy
user haproxy
group haproxy
defaults
log global
mode http
option dontlognull
timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms
errorfile 400 /usr/local/etc/haproxy/errors/400.http
errorfile 403 /usr/local/etc/haproxy/errors/403.http
errorfile 408 /usr/local/etc/haproxy/errors/408.http
errorfile 500 /usr/local/etc/haproxy/errors/500.http
errorfile 502 /usr/local/etc/haproxy/errors/502.http
errorfile 503 /usr/local/etc/haproxy/errors/503.http
errorfile 504 /usr/local/etc/haproxy/errors/504.http
listen stats
bind *:80
stats enable
stats uri / # must be present to see the logs
stats auth admin:admin
listen mqtt
bind *:1883
#bind *:8883 ssl crt /certs/emqtt.pem
mode tcp
# Use this to avoid the connection loss when client subscribed for a topic and its idle for sometime
option clitcpka # For TCP keep-alive
timeout client 3h # By default TCP keep-alive interval is 2hours in OS kernal, 'cat /proc/sys/net/ipv4/tcp_keepalive_time'
timeout server 3h # By default TCP keep-alive interval is 2hours in OS kernal
option tcplog
balance source
# docker hosts without swarm network
#server node_master 192.168.1.7:1883 check
#server node_node1 192.168.1.8:1883 check
#server node_node2 192.168.1.9:1883 check
# docker swarm network can use container names
server node_master emqtt-master:1883 check
server node_node1 emqtt-node1:1883 check
server node_node2 emqtt-node2:1883 check
listen mqtt-dashboard
bind *:18083
mode http
stats enable
stats uri /haproxy?stats
stats realm Strictly\ Private
stats auth admin:admin
balance roundrobin
option httpclose
option forwardfor
server node_master emqtt-master:18083 check
server node_node1 emqtt-node1:18083 check
server node_node2 emqtt-node2:18083 check