Linux中Too many open files

Linux中Too many open files 问题分析和解决_e929: too many viminfo temp files-CSDN博客

too many open files

出现这句提示的原因是程序打开的文件/socket连接数量超过系统设定值。

查看每个用户最大允许打开文件数量

ulimit -a

fdipzone@ubuntu:~$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 20
file size               (blocks, -f) unlimited
pending signals                 (-i) 16382
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) unlimited
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

其中 open files (-n) 1024 表示每个用户最大允许打开的文件数量是1024

查看当前系统打开的文件数量

lsof | wc -l
watch "lsof | wc -l"

lsof -p pid | wc -l
lsof -p 1234 | wc -l

你可能感兴趣的:(linux,运维,服务器)