csredis
csredis copied to clipboard
哨兵 Master 重新选举后出现 Connection was not opened
csreids 错误【172.21.96.2:6379/0】:Connection was not opened at CSRedis.Internal.IO.RedisIO.GetOrThrow[T](T obj)
at CSRedis.Internal.IO.RedisIO.get_Stream()
at CSRedis.Internal.IO.RedisIO.Write(Byte[] data)
at CSRedis.Internal.RedisConnector.Call[T](RedisCommand1 command) at CSRedis.RedisClient.Write[T](RedisCommand
1 command)
at CSRedis.RedisClient.HGet(String key, String field)
at CSRedis.CSRedisClient.<>c__DisplayClass207_0.<HGet>b__0(Object1 c, String k) at CSRedis.CSRedisClient.<>c__DisplayClass53_0
1.<ExecuteScalar>b__0(Object1 conn) at CSRedis.CSRedisClient.GetAndExecute[T](RedisClientPool pool, Func
2 handler, Int32 jump, Int32 errtimes)
System.Exception: Redis Sentinel Master is switching:Connection was not opened
at CSRedis.CSRedisClient.GetAndExecute[T](RedisClientPool pool, Func2 handler, Int32 jump, Int32 errtimes) at CSRedis.CSRedisClient.ExecuteScalar[T](String key, Func
3 hander)
at CSRedis.CSRedisClient.Exists(String key)
可以尝试 FreeRedis
【172.21.96.3:26379/0】Status unavailable, waiting for recovery. Connection refused
at FreeRedis.Internal.ObjectPool.ObjectPool1.GetFree(Boolean checkAvailable) at FreeRedis.Internal.ObjectPool.ObjectPool
1.Get(Nullable1 timeout) at FreeRedis.RedisClient.PoolingAdapter.GetRedisSocket(CommandPacket cmd) at FreeRedis.RedisClient.PubSub.Subscribe(Boolean psub, Boolean ssub, String[] channels, Action
3 handler)
at FreeRedis.RedisClient.Subscribe(String channel, Action2 handler) at FreeRedis.RedisClient.SentinelAdapter..ctor(RedisClient topOwner, ConnectionStringBuilder sentinelConnectionString, String[] sentinels, Boolean rw_splitting) at FreeRedis.RedisClient..ctor(ConnectionStringBuilder sentinelConnectionString, String[] sentinels, Boolean rw_splitting) at MD.Redis.Free.FreeRedisHelper.CreateFreeRedisClient(RedisOptions options) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync() at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()n--- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()n--- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) Connection refusedr at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) at System.Threading.Tasks.ValueTask.ValueTaskSourceAsTask.<>c.<.cctor>b__4_0(Object state)n--- End of stack trace from previous location --- at System.Threading.Tasks.TaskToApm.End(IAsyncResult asyncResult) at FreeRedis.Internal.DefaultRedisSocket.Connect() at FreeRedis.Internal.DefaultRedisSocket.Write(CommandPacket cmd) at FreeRedis.RedisClient.SingleInsideAdapter.<>c__DisplayClass5_0
1.<AdapterCall>b__0()
at FreeRedis.RedisClient.LogCallCtrl[T](CommandPacket cmd, Func1 func, Boolean aopBefore, Boolean aopAfter) at FreeRedis.RedisClient.LogCall[T](CommandPacket cmd, Func
1 func)
at FreeRedis.RedisClient.SingleInsideAdapter.AdapterCall[TValue](CommandPacket cmd, Func2 parse) at FreeRedis.RedisClient.Call(CommandPacket cmd) at FreeRedis.Internal.RedisClientPoolPolicy.PrevReheatConnectionPool(ObjectPool
1 pool, Int32 minPoolSize)"}
FreeRedis 情况类似。我们模拟的情况是直接把某个实例所在的服务器关掉。
情况基本与 https://github.com/2881099/FreeRedis/issues/180 一致