ulimit -n ulimit -n 65535 /etc/sysctl.conf 修改为 fs.file-max=65535
vm.max_map_count=262144
生效
/sbin/sysctl -p
查看进程打开文件数
lsof -p pid |wc -l
查看系统打开文件数
lsof |wc -l
最大文件数
ulimit -a
vi /etc/security/limits.conf
/proc/sys/fs/file-nr
已分配文件句柄的数目
已使用文件句柄的数目
文件句柄的最大数目
修改 /etc/security/limits.d/20-nproc.conf
vi /etc/security/limits.conf
末尾追加
* soft nofile 65536
* hard nofile 65536
* soft nproc 65536
* hard nproc 65536
本文详细介绍了如何在Linux系统中调整文件句柄和进程限制,通过修改sysctl.conf和limits.conf文件,设置fs.file-max、vm.max_map_count参数及nofile、nproc软硬限制,以提升系统性能。

被折叠的 条评论
为什么被折叠?



