Redis 集群就绪客户端

Redis cluster ready client

最近开始学习Redis,在32位学习方面已经无所不能Windows。我是一名 .net 开发人员,并在 Web API 设置中使用 ServiceStack client 使用 Redis 实现了缓存。我已经能够成功地 运行 一个由 4 个主节点和 4 个从节点组成的 Redis 集群,并且想知道我怎样才能使它与 ServiceStack 客户端一起工作。

我主要担心的是,如果我连接客户端的主机出现故障,那么客户端如何自动连接到接管的其他可用从机,因为该从机的端口将有所不同.所以故障转移是在 Redis 级别工作的,但是客户端如何处理它?

我使用 Redis 命令行界面重新创建了上述场景,但是当我关闭 master 时,界面就停止了响应,因为一切都在黑洞中进行。因此,根据我的经验,cli 不会作为客户端自动处理故障转移。

我已经开始研究StackExchange's clientRedis了,但是还是有同样的问题

我正在使用 Microsoft 提供的用于学习目的的 Redis 发行版,可在 Github 获得(抱歉,无法提供 link,因为我是新来的,没有足够的信誉点数)。

Redis Sentinel are additional Redis processes which monitor the health of your Redis Master/Slaves and takes care of performing Automatic Failover when it detects that your Master instance is down. The Redis Config project 提供了一种快速设置流行的 Redis Sentinel 配置的方法。

ServiceStack.Redis Client supports Redis Sentinel and implements the Recommended client Strategy 使它能够在故障转移后自动恢复,方法是向其中一个 Sentinels 询问要连接的下一个可用地址,并使用其中一个可用实例恢复操作。

您可以了解有关 Redis Sentinel in the official Documentation 的更多信息。