Hello.
Here’s my setup with a single server and 2 clients:
Redis v4.0.6 servers on (A)
ServiceStack.Redis v5.4.0 on (B) and (C)
It is for testing purposes only. All the server nodes reside in a single server (A):
On (B), the program works just fine.
On (C), the same program halts with the following stacktrace:
Unhandled Exception: ServiceStack.Redis.RedisException: No Redis Sentinels were available —> ServiceStack.Redis.RedisException: Exceeded timeout of 00:00:10 —> ServiceStack.Redis.RedisRetryableException: Socket is not connected**
at ServiceStack.Redis.RedisNativeClient.SendReceive[T](Byte cmdWithBinaryArgs, Func1 fn, Action
1 completePipelineFn, Boolean sendWithoutRead)
— End of inner exception stack trace —
at ServiceStack.Redis.RedisNativeClient.SendReceive[T](Byte cmdWithBinaryArgs, Func1 fn, Action
1 completePipelineFn, Boolean sendWithoutRead)
at ServiceStack.Redis.RedisNativeClient.SendExpectMultiData(Byte cmdWithBinaryArgs)
at ServiceStack.Redis.RedisNativeClient.SentinelGetMasterAddrByName(String masterName)
at ServiceStack.Redis.RedisSentinelWorker.GetMasterHostInternal(String masterName)
at ServiceStack.Redis.RedisSentinelWorker.GetSentinelInfo()
at ServiceStack.Redis.RedisSentinel.GetRedisManager()
at ServiceStack.Redis.RedisSentinel.GetValidSentinelWorker()
— End of inner exception stack trace —
at ServiceStack.Redis.RedisSentinel.GetValidSentinelWorker()
at ServiceStack.Redis.RedisSentinel.Start()
at M.RedisSentinel.Connect(Int32 no)
Code in M.RedisSentinel.Connect():
var sentinel = new ServiceStack.Redis.RedisSentinel(sentinels, masterName);
sentinel.RedisManagerFactory = (master, slaves) => new PooledRedisClientManager(
master,
slaves,
new RedisClientManagerConfig {
MaxReadPoolSize = 200,
MaxWritePoolSize = 200,
},
null,
200,
100);
var redis = sentinel.Start();
(C) → (A) connection seems to have no problem when tested with redis-cli.exe:
PS (C)> .\redis-cli.exe -h (A) -p 50003
(A):50003>
(A):50003>
(A):50003> info
'#Server
redis_version:4.0.6
redis_git_sha1:00000000
redis_git_dirty:0
…
I tried wireshark to see what’s happening and found some weird connection tries repeating every 0.1 seconds:
No. Time Source Destination Protocol Length Info
85 2.920814 (C) AWS (A) Server TCP 66 56974 → 50003 [SYN, ECN, CWR] Seq=0 Win=8192 Len=0 MSS=1460 WS=256 SACK_PERM=1
93 3.049107 (C) AWS (A) Server TCP 66 56975 → 50003 [SYN, ECN, CWR] Seq=0 Win=8192 Len=0 MSS=1460 WS=256 SACK_PERM=1
94 3.052747 (A) Server (C) AWS TCP 66 50003 → 56974 [SYN, ACK] Seq=0 Ack=1 Win=29200 Len=0 MSS=1460 SACK_PERM=1 WS=128
95 3.052760 (C) AWS (A) Server TCP 54 56974 → 50003 [RST] Seq=1 Win=0 Len=0
98 3.149554 (C) AWS (A) Server TCP 66 56976 → 50003 [SYN, ECN, CWR] Seq=0 Win=8192 Len=0 MSS=1460 WS=256 SACK_PERM=1
99 3.184345 (A) Server (C) AWS TCP 66 50003 → 56975 [SYN, ACK] Seq=0 Ack=1 Win=29200 Len=0 MSS=1460 SACK_PERM=1 WS=128
100 3.184359 (C) AWS (A) Server TCP 54 56975 → 50003 [RST] Seq=1 Win=0 Len=0
102 3.260759 (C) AWS (A) Server TCP 66 56977 → 50003 [SYN, ECN, CWR] Seq=0 Win=8192 Len=0 MSS=1460 WS=256 SACK_PERM=1
103 3.283531 (A) Server (C) AWS TCP 66 50003 → 56976 [SYN, ACK] Seq=0 Ack=1 Win=29200 Len=0 MSS=1460 SACK_PERM=1 WS=128
104 3.283544 (C) AWS (A) Server TCP 54 56976 → 50003 [RST] Seq=1 Win=0 Len=0
105 3.394375 (A) Server (C) AWS TCP 66 50003 → 56977 [SYN, ACK] Seq=0 Ack=1 Win=29200 Len=0 MSS=1460 SACK_PERM=1 WS=128
106 3.394390 (C) AWS (A) Server TCP 54 56977 → 50003 [RST] Seq=1 Win=0 Len=0
…
Nothing like this happens when I just used ServiceStack.Redis.RedisClient(host, port) to make direct connection to its master.