1

Have gotten 2 Redis instances installed, with one being a master. That is working remarkably well and with no headaches.

I'm now trying to get my HAProxy/keepalived nodes to handle some sort of failover.

1) Is that even possible - setting up a node as the master and the other as backup? This is what I am doing with my MySQL nodes:

        server 192.168.32.33 192.168.32.33:3306 check backup
        server 192.168.32.34 192.168.32.34:3306 check

2) If so, is there updated documentation on this? I've followed the documentation on the HAProxy's blog, as referenced below:

ServerFault article: Redis sentinel + HAProxy failover

But the nodes are showing up as down, even though I can use them via the CLI and other clients:

snapshot of failed Redis nodes in HA Proxy web interface

Using the CLI, if I issue the commands in the tcp-checks, the responses match the expected returns in the conf. (note: we don't have authentication turned on yet on the Redis nodes).

Here's my haproxy.cfg - starting with last line of my MySQL section

        server 192.168.32.34 192.168.32.34:3306 check 

defaults REDIS
        mode tcp
        timeout connect  4s
        timeout server  30s
        timeout client  30s

frontend ft_redis
        bind *:6379 name redis
        default_backend bk_redis

backend bk_redis
        option tcp-check
        tcp-check send PINGrn
        tcp-check expect string +PONG
        tcp-check send info replicationrn
        tcp-check expect string role:master
        tcp-check send QUITrn
        tcp-check expect string +OK
        server Site2DB3 192.168.32.36:6379 check inter 1s
        server Site1DB3 192.168.22.36:6379 check inter 1s

3 Answers3

2
PINGrn

should read

PING\r\n

Same for the other tcp-check messages. You're sending PINGrn instead of PING\r\n, an invalid command which will throw an error and thus cause your UP check to fail.

Ninpo
  • 21
  • 2
2

Also make sure you escape spaces after the tcp-check send like:

tcp-check send info\ replication\r\n
snelis
  • 21
  • 1
1

For REDIS that has authentication, add this :

tcp-check send AUTH\ xxx_xxx\r\n
Jenny D
  • 27,358
  • 21
  • 74
  • 110