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