# vim:ts=4:sts=4:sw=4:et # # Author: Hari Sekhon # Date: 2017-12-17 14:05:26 +0000 (Sun, 17 Dec 2017) # # https://github.com/HariSekhon/HAProxy-configs # # License: see accompanying Hari Sekhon LICENSE file # # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish # # https://www.linkedin.com/in/HariSekhon # # ============================================================================ # # H A P r o x y - R e d i s M a s t e r # ============================================================================ # frontend redis-master description "Redis Master" bind *:6379 mode tcp option tcplog default_backend redis-master backend redis-master description "Redis Master" #balance roundrobin balance first mode tcp acl internal_networks src 192.168.0.0/16 172.16.0.0/12 10.0.0.0/8 127.0.0.1 tcp-request content reject if ! internal_networks timeout queue 2s timeout connect 2s timeout check 1s option tcp-check 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 redis-master redis-master:6379 check server redis redis:6379 check backup server docker docker:6379 check backup server 192.168.99.100 192.168.99.100:6379 check backup