haproxy配置监控redis主备切换(转)
环境前提:
redis sentinel配置,三台主机,且配置运行良好
配置文件中添加:
frontend ft_redis
bind 0.0.0.0:6379 name redis
default_backend bk_redis
backend bk_redis
option tcp-check
tcp-check connect
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 R1 10.118.36.10:6379 check inter 1s
server R2 10.118.36.74:6379 check inter 1s
server R3 10.118.5.161:6379 check inter 1s
当结果如下所示,则表示成功,那么试着切换redis的master和slave吧
http://blog.csdn.net/gsying1474/article/details/49179651