错误异常too many open files解决方法
用命令ulimit -a查看
[root@localhost webapps]# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 31190
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) 31190
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
通过以上命令,我们可以看到open files 的最大数为1024
对于并发量比较大的网站这个限制是有些捉襟见肘的,所以我通过这个命令
ulimit -n 10240但是ulimit -n 10240 命令只能临时的改变open files 的值,当
重新登陆后又会恢复,所以需要永久设置open files 的值,
修改/etc/security/limits.conf 添加如下一行:
* - nofile 10240
以下是其他详细的介绍
https://www.linuxprobe.com/linux-too-file.html
https://blog.csdn.net/wteruiycbqqvwt/article/details/90483224
https://www.cnblogs.com/lenmom/p/9773093.html