【发布时间】:2020-03-31 14:59:32
【问题描述】:
基本上是使用 StackExchangeRedis 客户端连接到具有 3 个节点的 Redis 集群。
我的配置如下:
config.EndPoints.Add(IPAddress.Parse("Node1_IP"), port);
config.EndPoints.Add(IPAddress.Parse("Node2_IP"), port);
config.EndPoints.Add(IPAddress.Parse("Node3_IP"), port);
config.Password = "password";
config.DefaultDatabase = 0;
config.ConnectTimeout = ConfigurationOptionsConnectTimeout;
config.AsyncTimeout = ConfigurationOptionsConnectTimeout;
config.ConnectRetry = InitialConnectRetries;
config.ReconnectRetryPolicy = new ExponentialRetry(DeltaBackOffMilliseconds);
config.AbortOnConnectFail = false;
Node1 HashSlot 范围是 0-8191
Node2 HashSlot 范围是 8192-16383
Node3 没有 HashSlot 范围,我猜它就像一个奴隶。
错误:
StackExchange.Redis.RedisConnectionException: Endpoint Node1_IP:Port serving hashslot 14371 is
not reachable at this point of time. Please check connectTimeout value. If it is low, try increasing it
to give the ConnectionMultiplexer a chance to recover from the network disconnect. IOCP:
(Busy=0,Free=1000,Min=6,Max=1000), WORKER: (Busy=0,Free=8191,Min=6,Max=8191), Local-CPU: n/a
场景: 试图在数据库中存储一些键值。
当我的密钥在属于 Node2 哈希槽范围的哈希槽中进行哈希处理(基于 Redis 哈希函数)时,会发生上述错误。 在节点 1 哈希槽范围内进行哈希处理的键存储成功。
IF 我重新排列配置中的端点,首先添加Node2_IP,然后添加Node1_IP,然后可以成功存储在Node2哈希槽中散列的键,但在散列槽范围内散列的键Node1 分别产生相同的错误。
【问题讨论】:
标签: c# asp.net stackexchange.redis