The reason for this problem is the system's limit on the number of files that the program opens.
Use the ulimit-a command to view
[Root@5 ~]# Ulimit-a
Core file size (blocks,-c) 0
Data seg Size (Kbytes,-D) Unlimited
Scheduling Priority (-e) 0
File size (blocks,-f) Unlimited
Pending Signals (I.) 4096
Max locked Memory (Kbytes, L) 32
Max memory Size (Kbytes, M) Unlimited
Open files (-N) 1024
Pipe Size (bytes, p) 8
POSIX message queues (bytes,-Q) 819200
Real-time priority (-R) 0
Stack size (Kbytes,-s) 10240
CPU time (seconds,-t) unlimited
MAX User Processes (-u) 4096
Virtual Memory (Kbytes,-V) Unlimited
File locks (-X) Unlimited
As you can see, the number of restrictions on open files is 1024, and we can increase the number of files that can be opened by modifying this value.
******************************************************************
Temporary modifications:
Change it to 2048, with ulimit-n 2048.
When you increase the value of open files to a certain extent, your too many open files will not appear again.
******************************************************************
To change these two parameter values for a long time, modify the/ect/security/limits.conf and add two lines to the file:
The code is as follows:
*-Nofile 65535
*-Nproc 65535
Note: This line sets the default number of open files per user to 2048. Note that there are two possible restrictions on the "Nofile" item. Is the hard and soft under the item. For the maximum number of open files that have been modified to take effect, you must set both limits. If you use the "-" character setting, the hard and soft settings will be set at the same time.
The hard limit indicates the maximum value that can be set in the soft limit. The soft limit refers to the setting value in effect for the current system. Hard limit values can be reduced by ordinary users. But it can't be increased. The soft limit cannot be set higher than the hard limit. Only the root user can increase the hard limit value.
When adding a file limit description, you can simply double the current value. The example below, if you want to increase the default value of 1024, the best to increase to 2048, if you want to continue to increase, you need to set to 4096.
Finally with Ulimit-a again, open files value, no problem, it has been changed over.
******************************************************************
-------------------------------------------------------------
After the above settings, exit the shell login again, or not effective, to point to the
Under//etc/profile, join a line of Ulimit-shn 51200 (note that there is already a set of ulimit in it)
To Rc.local, join a line of Ulimit-shn 51200 (I do not know if this is necessary, in fact, I have not added)
Ulimit-s-C 0 >/dev/null 2>&1
This statement sets the size of the software resources and the core file