-
Notifications
You must be signed in to change notification settings - Fork 0
/
haproxy.cfg
67 lines (50 loc) · 1.56 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
65
66
# Sample haproxy config excerpt (paste it below your config as *defaults* section will reset your defaults)
# **MODIFY** accordingly.
# Redis master name is: mred1
# Redis server addresses are: 192.168.112.2, 192.168.112.3, 192.168.112.4
global
stats socket /run/haproxy.sock user REDCHECKUSER mode 600 level admin
stats timeout 2m
defaults redis_backends
mode tcp
log global
option dontlognull
option tcp-check
option log-health-checks
retries 2
timeout check 2s
timeout connect 4s
timeout client 2d
timeout server 2d
option srvtcpka
fullconn 9000
default-server maxconn 9000 inter 3s check fastinter 1s downinter 1s
backend b:mred1:192.168.112.2
tcp-check send PING\r\n
tcp-check expect string +PONG
# tcp-check send info\ replication\r\n
# tcp-check expect string role:master
tcp-check send QUIT\r\n
tcp-check expect string +OK
server s:mred1:192.168.112.2 192.168.112.2:6379
backend b:mred1:192.168.112.3
tcp-check send PING\r\n
tcp-check expect string +PONG
# tcp-check send info\ replication\r\n
# tcp-check expect string role:master
tcp-check send QUIT\r\n
tcp-check expect string +OK
server s:mred1:192.168.112.3 192.168.112.3:6379
backend b:mred1:192.168.112.4
tcp-check send PING\r\n
tcp-check expect string +PONG
# tcp-check send info\ replication\r\n
# tcp-check expect string role:master
tcp-check send QUIT\r\n
tcp-check expect string +OK
server s:mred1:192.168.112.4 192.168.112.4:6379
frontend f:redis:mred1
maxconn 200
option tcplog
bind :7777 name redis:mred1
use_backend b:mred1:%[str(mred1),map(/etc/haproxy/maps/redmaster)]