查看与配置
查看与配置
CONFIG GET maxclients
INFO clients | grep connected_clients
# 系统层:
ulimit -n
cat /proc/$(pgrep -f redis-server | head -1)/limits | grep 'open files'
# 调整(配置文件 + systemd LimitNOFILE):
# maxclients 20000
# 且需保证 ulimit -n >= maxclients + 32(内部用句柄)+ 复制需要的句柄| 默认 | 10000 |
|---|---|
| 受限于 | ulimit -n(差集留给内部 fd) |
| 打满表现 | ERR max number of clients reached |
连接打满先查来源:连接池泄漏、短连接未复用、攻击流量;直接调大 maxclients 只是把问题推后并扩大内存占用。