Fail-over connection to secured redis (no SENTINEL cmd)

127 views
Skip to first unread message

lorand....@gmail.com

unread,
Feb 19, 2019, 5:20:57 AM2/19/19
to lettuce-redis-client-users
Hi, 

We have a provisioned instance of redis from IBM Cloud (Redis for Compose). Based on documentation it is a clustered redis with sentinel. In front of the Redis there are two HAProxy instances. Those are my gateways to Redis, - I can connect only through them. The connection works fine, one by one. But I would like to have a fail-over setup: if one HAProxy goes down, I connect to the other. When I want to configure it as described in many places with sentinel, I get: 

ERR unknown command 'SENTINEL'

I understand that it a way to secure Redis by removing certain commands from it. But if I cannot access sentinel how shell I create a fail-over connection pool?

Thanks, 
Lorand.


mpa...@pivotal.io

unread,
Feb 19, 2019, 7:33:17 AM2/19/19
to lettuce-redis-client-users
Typically, you handle this kind of failover using DNS. You could put yet another HAProxy in front of the other ones but at some point, you'd recurse into the problem instead of solving it.

When using Redis Sentinel, you have typically three Sentinel nodes that act as HA topology registry. There's no need to put HA proxies instead of sentinel nodes as they are HA by running multiple instances.

If a Redis node goes down, then Lettuce contacts the sentinel nodes to determine which node is a master. Then, Lettuce re-establishes the connection to the active master node.

Does this help?

Cheers, 
Mark

lorand....@gmail.com

unread,
Feb 19, 2019, 10:00:04 AM2/19/19
to lettuce-redis-client-users
Thanks Mark, 

It does help. It clarifies few things for me. 

Digging deeper, does it make sense to have HAProxy at all? If the Redis client needs to know to whom to talk (master) then HAProxy cannot load balance or fail-over on it's own. Am I correct?

Regards, 
Lorand

Mark Paluch

unread,
Feb 19, 2019, 1:08:23 PM2/19/19
to lettuce-redis-client-users, lorand....@gmail.com
It might make sense to use HA proxy in the following two scenarios:

* Externally managed Redis HA using plain master/replica. The HA proxy always points to the active master while a failover is managed behind the scenes.
* Redis Cluster: HA proxy points to one/all active master nodes. The client then obtains the cluster topology and connects to the individual nodes (Microsoft Azure does this).

HA proxy is a solution to maintain a single DNS entry point that is kept highly available.

Cheers, 
Mark
--
You received this message because you are subscribed to the Google Groups "lettuce-redis-client-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lettuce-redis-clien...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lettuce-redis-client-users/9653e047-f1e2-4660-93f0-4412a8ca546b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

lorand....@gmail.com

unread,
Feb 21, 2019, 3:40:22 AM2/21/19
to lettuce-redis-client-users
Hi Mark, 

Thanks for the help. 

The solution I came up with: I test the connection at startup and if it fails (ping) I fail over the the other HAProxy. This requires restart, but at least we have some kind of a fail-over. Now I just need to ensure that if the connection goes down I crash my app and Cloud Foundry will do the rest...

Regards, 
L. 
To unsubscribe from this group and stop receiving emails from it, send an email to lettuce-redis-client-users+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages