简体   繁体   English

将StackExchange.Redis客户端与Redis群集一起使用

[英]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? 如何告诉StackExchange.Redis(v1.0.481),它将要连接到Redis集群(如果有关系,则为v3.2.6),而不仅仅是一个独立的/复制的实例? When I use the redis-cli for example, I have to pass a -c flag to make it cluster-aware. 例如,当我使用redis-cli时,我必须传递-c标志以使其具有群集感知能力。 Is there an equivalent flag in the StackExchange.Redis connection string? StackExchange.Redis连接字符串中是否存在等效标志?

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. 我已经搜索并遇到了几个连接字符串的示例,这些示例包括多个以逗号分隔的host:port参数,但没有任何示例明确使StackExchange.Redis具有群集意识。

Thanks. 谢谢。

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. 检查此问题以获取更多详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM