Linux error: too program open files

Source: Internet
Author: User

This problem occurs because system restricts the number of files opened by the program.

Use the ulimit-a command to view

We can see that the limit on the number of open files is 1024. We can increase the number of files that can be opened by modifying this value.

**************************************** **************************

Temporary modification:

Change it to 2048 and use ulimit-n 2048.

When you increase the value of open files to a certain extent, your Too program open files will no longer appear.

**************************************** **************************

To change these two parameter values for a long time, modify/ect/security/limits. conf and add two lines to the file:

*-Nofile 65535

*-Nproc 65535

Note: This line sets the default number of files opened by each user to 2048. Note that "nofile" has two possible restrictions. Is hard and soft under <type>. To make the maximum number of files opened after modification take effect, you must set these two restrictions. If you use the "-" character setting <type>, the hard and soft settings are set at the same time.

Hard limit indicates the maximum value that can be set in the soft limit. The soft limit refers to the setting value that takes effect for the current system. The hard limit value can be reduced by common users. But cannot be added. Soft restrictions cannot be set more than hard restrictions. Only root users can increase the hard limit value.

When the file limit description is added, you can simply double the current value. The example is as follows. If you want to increase the default value by 1024, it is best to increase it to 2048. If you want to continue to increase it, you need to set it to 4096.

Finally, use ulimit-a to check the value of open files again. If there is no problem, it has been changed.

**************************************** **************************

-------------------------------------------------------------

After the above settings, log out of shell and log on again, but it still does not take effect.

Add a ulimit-SHn 51200 row under // etc/profile (note that there is a setting for ulimit)

Add a ulimit-SHn 51200 line under rc. local (I don't know if this line is necessary, but I haven't added it yet)

For details, see:

Ulimit-S-c 0>/dev/null 2> & 1

This statement sets the software resources and core file size.

  • 1
  • 2
  • 3
  • Next Page

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.