How do I increase the maximum number of open files under CentOS Linux? How do I open more file descriptors under Linux?
The ulimit command provides control over the resources available to the shell and/or to processes started by it, on systems that allow such control. The maximum number of open file descriptors displayed with following command (login as the root user). ulimit 命令提供了针对 shell 和/或由该 shell 启动的进程占用资源的控制。
Command To List Number Of Open File Descriptors
Use the following command to display maximum number of open file descriptors:
The number of concurrently open file descriptors throughout the system can be changed via /etc/sysctl.conffile under Linux operating systems. 系统范围级别的 fd 数量控制需要编辑 /etc/sysctl.conf 内核参数配置文件。
The Number Of Maximum Files Was Reached, How Do I Fix This Problem?
Many application such as Oracle database or Apache web server needs this range quite higher. So you can increase the maximum number of open files by setting a new value in kernel variable /proc/sys/fs/file-max as follows (login as the root): 通过调整内核参数 /proc/sys/fs/file-max 来增加可打开 fd 数目。
Above command forces the limit to 100000 files. You need to edit /etc/sysctl.conf file and put following line so that after reboot the setting will remain as it is: 通过修改 /etc/sysctl.conf 文件，可以在令针对 fd 的修改一直生效。
The above procedure sets system-wide file descriptors (FD) limits. However, you can limit httpd (or any other users) user to specific limits by editing /etc/security/limits.conffile, enter: 通过修改 /etc/security/limits.conf 文件可以在用户级别对 fd 进行限制。