Linux increase the Maximum number of Open files/file descriptors (FD)

Source: Internet
Author: User

How do I increase the maximum number of open files under CentOS Linux? How does 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 system s that allow such control. The maximum number of open file descriptors displayed with following command (login as the root user).

Command to List number of Open File descriptors

Use the following command command to display maximum number of open file descriptors:
cat /proc/sys/fs/file-max
Output:

75000

75000 files Normal user can have the open in single login session. To see the hard and soft values, issue the command as follows:
# ulimit -Hn
# ulimit -Sn

The hard and soft values for httpd or Oracle user, issue the command as follows:
# su - username
In the example, Su to Oracle user, enter:
# su - oracle
$ ulimit -Hn
$ ulimit -Sn

System-wide File descriptors (FD) Limits

The number of concurrently open file descriptors throughout the system can be changed via/etc/sysctl.conf file under Linu x operating systems.

The number of Maximum Files was reached, how does 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 fo Llows (login as the root):
# sysctl -w fs.file-max=100000
Above command forces the limit to 100000 files. You need to edit/etc/sysctl.conf file and put following line so, after reboot the setting would remain as it is:
# vi /etc/sysctl.conf
Append a config directive as follows:
fs.file-max = 100000
Save and close the file. Users need to logs out and logs back in again to changes take effect or just type the following command:
# sysctl -p
Verify your settings with command:
# cat /proc/sys/fs/file-max
OR
# sysctl fs.file-max

User level FD Limits

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.conf file, enter :
# vi /etc/security/limits.conf
Set httpd user soft and hard limits as follows:
httpd soft nofile 4096
httpd hard nofile 10240

Save and close the file. To see limits, enter:
# su - httpd
$ ulimit -Hn
$ ulimit -Sn

A Note about Rhel/centos/fedora/scientific Linux users

Edit/etc/pam.d/login file and add/modify the following line (make sure get pam_limts.so):

Session Required Pam_limits.so

Save and close the file.

from:https://www.cyberciti.biz/faq/linux-increase-the-maximum-number-of-open-files/

Linux increase the Maximum number of Open files/file descriptors (FD)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.