RedisConnectionException:无法连接到Redis服务器。连接超时

时间:2018-10-22 13:46:50

标签: c# redis stackexchange.redis

我已经看到有关此错误的各种问题,但找不到任何相关的解决方案。

我正在使用 stackexchange.redis.strongname 程序集版本 1.2.6.0 连接到 redis服务器版本3.2.10 ,并随机面对RedisConnectionException。 我们的架构是基于AWS托管的Web场架构,有时一台机器无法连接到Redis服务器,但另一台机器运行良好。因此,这使我们确信Redis服务器已启动并且可以正常工作。此外,当一台计算机无法连接并且工作正常且没有任何问题时,我们也尝试使用redis-cli.exe进行连接。

我要分享以下完整的例外情况:

#if stored dictionary like strings
df['score']=df['score'].map(ast.literal_eval) 

df1 = pd.DataFrame(df.pop('score').values.tolist())
df1.columns = [f'score{i}' for i in range(1, len(df1.columns) + 1)]
df = df1.join(df)
print (df)
   score1  score2     pvpdate
0      29      24  2018-05-23
1      23      24  2018-05-29
2      36      25  2018-05-23

这是我用来创建与Redis服务器的连接的代码

[RedisConnectionException: It was not possible to connect to the redis server(s); ConnectTimeout]

    [RedisConnectionException: No connection is available to service this operation: EVAL; It was not possible to connect to the redis server(s); ConnectTimeout; IOCP: (Busy=0,Free=1000,Min=2,Max=1000), WORKER: (Busy=767,Free=32000,Min=2,Max=32767), Local-CPU: n/a]
       StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImpl(Message message, ResultProcessor`1 processor, ServerEndPoint server) +4657
       StackExchange.Redis.RedisBase.ExecuteSync(Message message, ResultProcessor`1 processor, ServerEndPoint server) +122
       StackExchange.Redis.RedisDatabase.ScriptEvaluate(String script, RedisKey[] keys, RedisValue[] values, CommandFlags flags) +142
       Microsoft.Web.Redis.<>c__DisplayClass4.<Eval>b__3() +56
       Microsoft.Web.Redis.StackExchangeClientConnection.RetryForScriptNotFound(Func`1 redisOperation) +135
       Microsoft.Web.Redis.StackExchangeClientConnection.RetryLogic(Func`1 redisOperation) +144
       Microsoft.Web.Redis.StackExchangeClientConnection.Eval(String script, String[] keyArgs, Object[] valueArgs) +542
       Microsoft.Web.Redis.RedisConnectionWrapper.TryTakeWriteLockAndGetData(DateTime lockTime, Int32 lockTimeout, Object& lockId, ISessionStateItemCollection& data, Int32& sessionTimeout) +262
       Microsoft.Web.Redis.RedisSessionStateProvider.GetItemFromSessionStore(Boolean isWriteLockRequired, HttpContext context, String id, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actions) +1160
       Microsoft.Web.Redis.RedisSessionStateProvider.GetItemExclusive(HttpContext context, String id, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actions) +211
       System.Web.SessionState.SessionStateModule.GetSessionStateItem() +176
       System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData) +1018
       System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +710
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +634

任何人都可以帮助我找出此问题的根本原因,或者一些调试它的步骤也会有很大帮助。

0 个答案:

没有答案