URIs for creating RedisClusterClient?

386 views
Skip to first unread message

mykev...@gmail.com

unread,
Dec 9, 2016, 7:17:54 PM12/9/16
to lettuce-redis-client-users
Hello,

Let's say I have a redis cluster with 3 masters and 3 slaves, and have the following URIs:
  • redis://master-1:some-port
  • redis://master-2:some-port
  • redis://master-3:some-port
  • redis://slave-1:some-port
  • redis://slave-2:some-port
  • redis://slave-3:some-port
When I build RedisClusterClient, am I supposed to pass all 6 URIs into RedisClusterClient.create(Iterable<RedisURI> redisURIs), or to pass 3 master URIs or any one of 6 URIs?

Or, am I supposed to have a virtual IP and put all masters/slaves behind the virtual IP?

Thank you in advance!
Kevin

Mark Paluch

unread,
Dec 10, 2016, 8:49:44 AM12/10/16
to lettuce-redis-client-users, mykev...@gmail.com
Hi Kevin, 
it's up to you. Lettuce discovers the topology from the Cluster which requires you to provide at least one connection point. 

It's always better to provide more than one address to ensure your application can start up when one node is down.

Cheers, 
Mark

mykev...@gmail.com

unread,
Dec 10, 2016, 12:35:40 PM12/10/16
to lettuce-redis-client-users, mykev...@gmail.com
Hi Mark,

Thanks for the confirmation.  I am using periodic refresh and all adaptive refresh triggers, so I was guessing that Lettuce might discover the topology.

Does Lettuce refresh the topology as soon as a connection is established or Lettuce uses the given URIs until periodic refresh or adaptive refresh happens?

Thanks,
Kevin

Mark Paluch

unread,
Dec 10, 2016, 1:05:55 PM12/10/16
to lettuce-redis-client-users, mykev...@gmail.com
Lettuce obtains the initial topology view upon RedisClusterClient.connect. Background topology update starts in the same moment, if enabled.

mykev...@gmail.com

unread,
Dec 10, 2016, 1:19:24 PM12/10/16
to lettuce-redis-client-users, mykev...@gmail.com
Nice!  Thank you for the information Mark!

mykev...@gmail.com

unread,
Dec 12, 2016, 1:01:07 PM12/12/16
to lettuce-redis-client-users, mykev...@gmail.com
Hi Mark,

What if I put the nodes behind virtual IP and pass the vip to RedisClusterClient.create(), then will Lettuce communicate using the vip all the time, or get the topology using the vip at the first time and communicate based on the topology afterward (without relying on vip)?

Thanks,
Kevin
Message has been deleted

Mark Paluch

unread,
Dec 12, 2016, 2:05:02 PM12/12/16
to lettuce-redis-client-users, mykev...@gmail.com
You can do so (that's what Microsoft Azure Redis Cluster is doing). When using Lettuce 4.2.1 or earlier, make sure to disable cluster node membership validation [0]. Later versions do not require this setting.
Reply all
Reply to author
Forward
0 new messages