更新时间:2024-04-12 GMT+08:00
分享

常见客户端报错及解决方法

问题现象1

  • 问题现象:客户端打印网络超时10秒,连接失败。
    CommonResponseAspect exception!Redis command timed out; nested exception is io.lettuce.core.RedisCommandTimeoutException: Command timed out after 10 second(s)
  • 报错客户端:Lettuce。
  • 可能原因:客户端网络带宽打满。
  • 解决方法:排查业务侧资源,解决客户端侧资源瓶颈。

问题现象2

  • 问题现象:客户端偶尔打印连接不可用。
    [redisClient=[addr=XXXX], channel=[id: 0x0a0d20bc, L:0.0.0.0/0.0.0.0:53192]] is not active!
  • 报错客户端:Redisson。
  • 可能原因:客户端重连机制不完善导致,当服务侧HA倒换后可能遇到该现象。
  • 解决方法:重启客户端

问题现象3

  • 问题现象:应用报错“Could not get a resource from the pool”,同时检查业务程序所在ECS有大量CLOSE_WAIT的TCP连接。
  • 报错客户端:Jedis、Lettuce。
  • 可能原因:通常由于客户端程序配置的连接池过小,在业务并发激增时与Redis建立的连接不够用。
  • 解决方法:排查业务代码,设置足够的连接池配置

问题现象4

  • 问题现象:客户程序连接池超时,报错信息如下:
    “redis: connection pool timeout
    You can get that error when there are no free connections in the pool for Options.PoolTimeout duration. If you are using redis.PubSub or redis.Conn, make sure to properly release PuSub/Conn resources by calling Close method when they are not needed any more.
    You can also get that error when Redis processes commands too slowly and all connections in the pool are blocked for more than PoolTimeout duration.”
  • 报错客户端:Go-redis。
  • 可能原因:通常由于客户端程序配置的连接池过小,在业务并发激增时与Redis建立的连接不够用。
  • 解决方法:排查业务代码,设置足够的连接池配置
分享:

    相关文档

    相关产品