zoukankan      html  css  js  c++  java
  • redis各类错误可能的解决方案

    1.报Timeout performing EVAL

    这个可能是连到读库从库了,直接改成写库就没问题了。

    2.

    各种ConnectTimeout

    一般是偶尔或经常就超时,这种情况,找了各种回答,最后在stackoverflow上看到一个大佬给了个解决方法,试了下,可以了。

    对应地址:https://stackoverflow.com/questions/23160094/stackexchange-redis-connectionmultiplexer-connect-intermittently-works

    内容是:

    I could solve the above by doing this :

    The error you are getting is usually a sign that you have not set abortConnect=false in your connection string. The default value for abortConnect is true, which makes it so that StackExchange.Redis won't reconnect to the server automatically under some conditions. We strongly recommend that you set abortConnect=false in your connection string so that SE.Redis will auto-reconnect in the background if a network blip occurs.

    Source : https://stackoverflow.com/a/30918632/2236811

    So my init() looked like this

     ConfigurationOptions co = new ConfigurationOptions()
            {
                SyncTimeout = 500000,
                EndPoints =
                {
                    {url,portNumber }
                },
                AbortOnConnectFail = false // this prevents that error
            };
    
            seClient = ConnectionMultiplexer.Connect(co);

    thanks

    以上。如果看不懂英文不要紧,把代码复制去用就行了。

    比如我是这样写的:

    192.168.0.1:6379,abortConnect=false,syncTimeout=500000

    这样子就可以了。

    以上所有redis操作用的都是:StackExchange.Redis  来进行的。

  • 相关阅读:
    iOS7,iOS8和iOS9的区别
    NSUrl
    什么是 MIME TYPE?
    TCP协议与UDP协议的区别
    KVC、KVO、NSNotification、delegate 总结及区别
    cocoapods 安装过程及常见问题
    素材丶资料
    方法 笔记(二)
    UIWebView UITextView
    在oj中Python的循环输入问题解决
  • 原文地址:https://www.cnblogs.com/qiywtc/p/9318158.html
Copyright © 2011-2022 走看看