Number of Linux open files too many open file solution

Source: Internet
Author: User

Number of Linux open files too many open file solution


Too many open files

The reason for this is that the program opened the file/socket the number of connections exceeds the system set value.


View the maximum number of open files per user

Ulimit-a

[Email protected]:~$ ulimit-acore File size          (blocks,-c) 0data seg size           (Kbytes,-D) unlimitedscheduling priority             (-e) 20file size               (blocks,-f) unlimitedpending signals (-I                 ) 16382max locked memory       (Kbytes, L) 64max memory size         (Kbytes,-M) Unlimitedopen files                      (-N) 1024pipe size            (bytes,-p) 8POSIX message Queues     (bytes,-q) 819200real-time Prio Rity              (-R) 0stack size              (Kbytes,-s) 8192cpu time               (seconds,-t) Unlimitedmax user Processes              (-u) Unlimitedvirtual Memory          (Kbytes,-V) unlimitedfile locks                      (-X) Unlimited

among the open files (-N) , the maximum number of open documents per user is


View the number of files open on the current system

lsof | Wc-lwatch "Lsof | Wc-l "

View the number of open files for a process

Lsof-p PID | WC-LLSOF-P 1234 | Wc-l

Set the open files numeric method

Ulimit-n 2048

[Email protected]:~$ ulimit-n 2048[email protected]:~$ ulimit-acore file size          (blocks,-c) 0data seg size           (kbyte S,-D) unlimitedscheduling priority             (-e) 20file size               (blocks,-f) unlimitedpending signals (-I                 ) 16382max Locked Memory       (Kbytes,-L) 64max memory size         (Kbytes,-m) unlimitedopen files                      (-N) 2048pipe size            (up to Byt ES,-P) 8POSIX message Queues     (bytes,-Q) 819200real-time priority              (-R) 0stack size              (Kbytes,-s) 8192cpu Tim E               (seconds,-t) Unlimitedmax user Processes              (-u) unlimitedvirtual memory          (Kbytes,-V) unlimitedfile Locks                      (-X) Unlimited

This allows you to set the maximum number of open files for the current user to 2048. However, such a setup method reverts to the default value after restarting.


Permanent Setup Method

Vim/etc/security/limits.conf at last added * soft nofile 4096* hard nofile 4096
The First * represents the entire user. Depending on the need to set up a user, such as

Fdipzone soft nofile 8192fdipzone hard Nofile 8192
It will take effect if you cancel it after you change it.


Number of Linux open files too many open file solution

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.