Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using StackExchange.Redis client with Redis cluster

How do I tell StackExchange.Redis (v1.0.481) that it's about to connect to a Redis cluster (v3.2.6, in case it matters), and not just a standalone/replicated instance? When I use the redis-cli for example, I have to pass a -c flag to make it cluster-aware. Is there an equivalent flag in the StackExchange.Redis connection string?

I've searched for and come across several examples of connection strings that include multiple comma-separated host:port parameters, but nothing that explicitly makes StackExchange.Redis cluster-aware.

Thanks.

like image 496
user7295971 Avatar asked Dec 14 '16 10:12

user7295971


1 Answers

If you have a cluster, you will connect to the cluster no matter if you put one or more endpoints on the connection string. There is no flag to connect to a cluster.

Putting more than one endpoint on your connection string is good for High Availability, so if one of the nodes is down, you'll be able to start the connection to other node.

The internal list of nodes is updated and expanded automatically. You don't need to put all the endpoints on the connection string.

Check this issue for more details.

like image 196
thepirat000 Avatar answered Oct 13 '22 11:10

thepirat000