在
Linux上运行的服务器应用程序通常需要大量的打开文件处理程序,例如.
HBase ulimit,Hadoop epoll limit
此Wiki条目应作为Linux文件限制配置的纪录片.
>什么是软限制与硬限制?
>如何控制硬限制?
>如何控制软限制?
>内核fs.file-max和用户ulimit -n是否相关?
请描述您的配置有效的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
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。