在Linux上运行的服务器应用程序通常需要大量的打开文件处理程序,例如。 HBase ulimit , Hadoop epoll限制
这个wiki条目应该作为Linux文件限制configuration的文件。
请描述你的configuration有效的Linux发行版,因为不同的供应商configuration不同的东西。
更新根据lstvan回答:
对于希望自动化的人来说,至less在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个configuration文件,可以很容易地扩展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
如果您要增加Ubuntu上的文件限制,则可以使用星号来指示“所有用户”限制软文件和硬文件的限制。 但是,这不包括root用户,因此如果您希望增加的限制适用于root用户,则必须单独定义它(因此,您可以为“root用户”设置不同的限制,并且“为所有人其他“),如下所示:
* soft nofile 4096 * hard nofile 10240 root soft nofile 4096 root hard nofile 10240
将它们添加到单独的文件中可能是最干净的,例如/etc/security/limits.d/60-nofile-limit.conf