Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

哨兵 Master 重新选举后出现 Connection was not opened #508

Open
beckjin opened this issue Apr 15, 2024 · 3 comments
Open

哨兵 Master 重新选举后出现 Connection was not opened #508

beckjin opened this issue Apr 15, 2024 · 3 comments

Comments

@beckjin
Copy link

beckjin commented Apr 15, 2024

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](RedisCommand1 command)
at CSRedis.RedisClient.HGet(String key, String field)
at CSRedis.CSRedisClient.<>c__DisplayClass207_0.b__0(Object1 c, String k) at CSRedis.CSRedisClient.<>c__DisplayClass53_01.b__0(Object1 conn) at CSRedis.CSRedisClient.GetAndExecute[T](RedisClientPool pool, Func2 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, Func3 hander)
at CSRedis.CSRedisClient.Exists(String key)

@2881099
Copy link
Owner

2881099 commented Apr 15, 2024

可以尝试 FreeRedis

@beckjin
Copy link
Author

beckjin commented Apr 30, 2024

【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.ObjectPool1.Get(Nullable1 timeout) at FreeRedis.RedisClient.PoolingAdapter.GetRedisSocket(CommandPacket cmd) at FreeRedis.RedisClient.PubSub.Subscribe(Boolean psub, Boolean ssub, String[] channels, Action3 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_01.b__0()
at FreeRedis.RedisClient.LogCallCtrl[T](CommandPacket cmd, Func1 func, Boolean aopBefore, Boolean aopAfter) at FreeRedis.RedisClient.LogCall[T](CommandPacket cmd, Func1 func)
at FreeRedis.RedisClient.SingleInsideAdapter.AdapterCall[TValue](CommandPacket cmd, Func2 parse) at FreeRedis.RedisClient.Call(CommandPacket cmd) at FreeRedis.Internal.RedisClientPoolPolicy.PrevReheatConnectionPool(ObjectPool1 pool, Int32 minPoolSize)"}

FreeRedis 情况类似。我们模拟的情况是直接把某个实例所在的服务器关掉。

@beckjin
Copy link
Author

beckjin commented May 1, 2024

情况基本与 2881099/FreeRedis#180 一致

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants