Too many open files 解决**方法

Too many open files 解决**方法

Linux系统默认允许用户打开的文件数是1024,对于很多用户/程序来说,这个值是不够用的,怎么扩大呢?

ulimit -a 确认查看一下哦!

查看当前打开的文件数量
lsof | wc -l
watch "lsof | wc -l"

临时设置:设置 open files 数值方法(只能临时生效,重启后还原默认的1024)

ulimit -n 2048

永久设置方法:

vim /etc/security/limits.conf

在最后加入

* soft nofile 4096
* hard nofile 4096

最前的 * 表示所有用户,可根据需要设置某一用户,例如

hw soft nofile 8192
hw hard nofile 8192

改完后重新远程或者注销一下就能生效。

posted @ 2021-01-06 11:02  太白之魔童降世  阅读(609)  评论(0)    收藏  举报