环境前提:
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吧
by 刘迎光@萤火虫工作室
OpenBI交流群:495266201
MicroService 微服务交流群:217722918
mail: liuyg#liuyingguang.cn
博主首页(防止爬虫):http://blog.liuyingguang.cn
OpenBI问答社区:http://openbi.liuyingguang.cn/