search

Home  >  Q&A  >  body text

node.js - Questions about redis connection

I recently wrote a project using nodeJS and connected to remote redis. When using the system after deployment, the error of redis connection failure occasionally occurs, so it needs to be restarted. However, the connection failure or timeout has become more frequent recently. It's happening more and more often. I don't know what's causing it and how to solve it?

过去多啦不再A梦过去多啦不再A梦2808 days ago952

reply all(1)I'll reply

  • 黄舟

    黄舟2017-05-16 13:22:28

    redis的配置有最大空闲连接时间,你可以先看看配置是什么CONFIG GET TIMEOUT
    。如果 CONGIG SET TIMEOUT 0 设置为0,则redisThe server will not actively disconnect.

    Of course, the redis driver of nodejs should check the survival status of the connection before executing the query command, and then execute the query command.

    reply
    0
  • Cancelreply