StackExchange.Redis.RedisConnectionException: SocketClosed

问题描述

我已经在托管在 Google Kubernetes Engine (GKE) 中的 .NET Core 5 中部署了多个微服务。此微服务使用 SignalR 与外部服务进行 websockets 通信,并且对于水平扩展,必须使用 Redis Backplane 和 StackExchange.Redis

我已经使用 GCP Marketplace 部署了一个 redis-ha 解决方案,但我在 StackExchange 和 redis-ha 之间存在连接问题。连接字符串看起来不错,连接正常,但每隔几秒就会失败并重新连接,在日志中留下以下错误

Connection to Redis Failed.
StackExchange.Redis.RedisConnectionException: SocketClosed (ReadEndOfStream,last-recv: 0) on 10.10.10.44:6379/Subscription,Idle/MarkProcessed,last: SUBSCRIBE,origin: ReadFromPipe,outstanding: 0,last-read: 0s ago,last-write: 30s ago,keep-alive: 60s,state: ConnectedEstablished,mgr: 9 of 10 available,in: 0,in-pipe: 0,out-pipe: 0,last-heartbeat: 0s ago,last-mbeat: 0s ago,global: 0s ago,v: 2.0.593.37019
Connection to Redis restored.

这是我在 NetCore 微服务中使用的连接字符串:

10.10.10.44,password=xxxx,abortConnect=false,syncTimeout=30000

你知道会发生什么吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)