Skip to content

Instantly share code, notes, and snippets.

@dot-mike
Created December 2, 2024 17:43
Show Gist options
  • Save dot-mike/3dec5d3440c0ca8203670475a80ca700 to your computer and use it in GitHub Desktop.
Save dot-mike/3dec5d3440c0ca8203670475a80ca700 to your computer and use it in GitHub Desktop.
haproxy true master for redis
frontend redis-read
bind *:6379
default_backend redis-online
frontend redis-write
bind *:6380
default_backend redis-primary
backend redis-primary
mode tcp
balance first
option tcp-check
tcp-check send info\ replication\r\n
tcp-check expect string role:master
server redis-01:10.3.61.117:6379 192.168.1.11:6379 maxconn 1024 check inter 1s
server redis-02:10.4.61.116:6379 192.168.1.12:6379 maxconn 1024 check inter 1s
backend redis-online
mode tcp
balance roundrobin
option tcp-check
tcp-check send PING\r\n
tcp-check expect string +PONG
server redis-01:10.3.61.117:6379 192.168.1.11:6379 maxconn 1024 check inter 1s
server redis-02:10.4.61.116:6379 192.168.1.12:6379 maxconn 1024 check inter 1s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment