-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhaproxy.conf
40 lines (35 loc) · 1.28 KB
/
haproxy.conf
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
global
daemon
chroot /data/haproxy
user vagrant
group vagrant
defaults
timeout connect 1000ms
timeout server 1000ms
timeout client 1000ms
frontend frontend_mongodb
mode tcp
bind *:27016
default_backend backend_mongodb
backend backend_mongodb
option tcp-check
# @see https://blog.danman.eu/mongodb-haproxy/
# Wire protocol
tcp-check send-binary 3a000000 # Message Length (58)
tcp-check send-binary EEEEEEEE # Request ID (random value)
tcp-check send-binary 00000000 # Response To (nothing)
tcp-check send-binary d4070000 # OpCode (Query)
tcp-check send-binary 00000000 # Query Flags
tcp-check send-binary 61646d696e2e # fullCollectionName (admin.$cmd)
tcp-check send-binary 24636d6400 # continued
tcp-check send-binary 00000000 # NumToSkip
tcp-check send-binary FFFFFFFF # NumToReturn
# Start of Document
tcp-check send-binary 13000000 # Document Length (19)
tcp-check send-binary 10 # Type (Int32)
tcp-check send-binary 69736d617374657200 # ismaster:
tcp-check send-binary 01000000 # Value : 1
tcp-check send-binary 00 # Term
tcp-check expect binary 69736d61737465720001 #ismaster True
server mongodb_27017 127.0.0.1:27017 check inter 1s
server mongodb_27018 127.0.0.1:27018 check inter 1s