如何使用fs.file-max和ulimit配置linux文件描述符限制
发布时间:2020-12-13 17:19:21 所属栏目:Linux 来源:网络整理
导读:在 Linux上运行的服务器应用程序通常需要大量的打开文件处理程序,例如. HBase ulimit,Hadoop epoll limit 此Wiki条目应作为Linux文件限制配置的纪录片. 什么是软限制与硬限制? 如何控制硬限制? 如何控制软限制? 内核fs.file-max和用户ulimit -n是否相关?
在
Linux上运行的服务器应用程序通常需要大量的打开文件处理程序,例如.
HBase ulimit,Hadoop epoll limit
此Wiki条目应作为Linux文件限制配置的纪录片. >什么是软限制与硬限制? 请描述您的配置有效的Linux发行版,因为各个供应商以不同的方式配置内容. 根据lstvan回复更新: 对于希望自动执行此操作的人,至少在Ubuntu服务器上,您可以将其放入计算机安装脚本中: echo 'fs.file-max = 65000' > /etc/sysctl.d/60-file-max.conf echo '* soft nofile 65000' > /etc/security/limits.d/60-nofile-limit.conf echo '* hard nofile 65000' >> /etc/security/limits.d/60-nofile-limit.conf echo 'root soft nofile 65000' >> /etc/security/limits.d/60-nofile-limit.conf echo 'root hard nofile 65000' >> /etc/security/limits.d/60-nofile-limit.conf 解决方法
您的操作系统设置了主机上任何正在运行的应用程序可以打开的文件数量限制.您可以通过修改2个配置文件轻松扩展基本值1024(通常为1024):
# vi /etc/sysctl.conf fs.file-max = 32000 # vi /etc/security/limits.conf youruser soft nofile 10000 youruser hard nofile 30000 硬和软的限制: man 5 limits.conf hard for enforcing hard resource limits. These limits are set by the superuser and enforced by the Kernel. The user cannot raise his requirement of system resources above such values. soft for enforcing soft resource limits. These limits are ones that the user can move up or down within the permitted range by any pre-exisiting hard limits. The values specified with this token can be thought of as default values,for normal system usage. HTH (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |