问题描述
生产环境上突然出现数据中断的情况,分析日志发现应用连接Redis出现“max number of clients reached”的异常。那么问题很明显了,某个应用将Redis的连接占满了。
分析方法
- 第一步,先分析Redis.conf文件,确认配置的连接数为多少,我们系统采用的默认值10000。
################################### CLIENTS ####################################
# Set the max number of connected clients at the same time. By default
# this limit is set to 10000 clients, however if the Redis server is not
# able to configure the process file limit to allow for the specified limit
# the max number of allowed clients is set to the current file limit
# minus 32 (as Redis reserves a few file descriptors for internal uses).
#