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

编程入门 行业动态 更新时间:2024-10-26 19:37:16
本文介绍了将 StackExchange.Redis 客户端与 Redis 集群一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我如何告诉 StackExchange.Redis (v1.0.481) 它即将连接到 Redis 集群(v3.2.6,以防万一),而不仅仅是一个独立/复制的实例?例如,当我使用 redis-cli 时,我必须传递一个 -c 标志以使其能够识别集群.StackExchange.Redis 连接字符串中是否有等效标志?

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?

我搜索并发现了几个包含多个逗号分隔的 host:port 参数的连接字符串示例,但没有任何内容明确使 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.

谢谢.

推荐答案

如果您有一个集群,那么无论您在连接字符串上放置一个还是多个端点,您都将连接到该集群.没有连接到集群的标志.

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.

查看此问题了解更多详情.

更多推荐

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

本文发布于:2023-11-23 11:16:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1621255.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:集群   客户端   StackExchange   Redis

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!