Skip to content

Instantly share code, notes, and snippets.

@juffaz
Created December 4, 2018 06:09
Show Gist options
  • Save juffaz/bae870650edc2f0c324c3f60e84b5a6c to your computer and use it in GitHub Desktop.
Save juffaz/bae870650edc2f0c324c3f60e84b5a6c to your computer and use it in GitHub Desktop.
haproxy for redis master slave
#### redis ###
defaults REDIS
mode tcp
option tcplog
timeout connect 4s
timeout server 30s
timeout client 30s
frontend ft_redis
bind 10.1.255.50:6379 name redis
default_backend bk_redis
backend bk_redis
option tcp-check
tcp-check connect
tcp-check send AUTH\ redisPASS\r\n
tcp-check expect string +OK
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 VAPFEREDIS01 10.1.255.51:6379 check
server VAPFEREDIS01 10.1.255.51:6379 check inter 1s
# server VAPFEREDIS02 10.1.255.52:6379 check backup
server VAPFEREDIS02 10.1.255.52:6379 check inter 1s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment