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?
redis
的配置有最大空闲连接时间,你可以先看看配置是什么CONFIG GET TIMEOUT
。如果
CONGIG SET TIMEOUT 0
设置为0
,则redis
The 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.