首页 > 技术文章 > Linux文件句柄数配置

dushenzi 2019-10-16 10:54 原文

1、单程序句柄数限制

查看配置的句柄数:ulimit -n

 

cat /etc/security/limits.conf

参考配置:

* soft nofile 655360
* hard nofile 655360

 

2、全局句柄数限制

cat /proc/sys/fs/file-max

参考配置:

6815744

 

3、分析句柄数常用命令

(1)统计各进程打开句柄数:lsof -n|awk '{print $2}'|sort|uniq -c|sort -nr

(2)统计各用户打开句柄数:lsof -n|awk '{print $4}'|sort|uniq -c|sort -nr

(3)统计各命令打开句柄数:lsof -n|awk '{print $1}'|sort|uniq -c|sort -nr

 

推荐阅读