First, the problem appearance:
Program Log error: Java.io.IOException:Too many open files at
Second, the solution:
1. Check the maximum number of files that the system is allowed to open:
Cat/proc/sys/fs/file-max
2. View the maximum number of files allowed to open per User:
Ulimit-a
3, the discovery system default is open files (-N) 1024, the problem appears here.
Modify this quantity limit in the system file /etc/security/limits.conf to include content in the file:
* Soft Nofile 65536
* Hard Nofile 65536
Another method:
1, use Ps-ef |grep Java (Java on behalf of your program, view your program process) to view your process ID, record ID number, assuming the process ID is 12
2. Using lsof-p | wc-l View the current file operation status for process ID 12
A file usage of 1052 occurs when the command is executed
3. Use the command ulimit-a to see the maximum number of files allowed to open per user
The discovery system defaults to open files (-N) 1024, which is where the problem occurs.
4. Then execute ulimit-n 4096
Set open files (-N) 1024 to open files (-N) 4096
Excerpt from: https://www.aliyun.com/jiaocheng/120721.html
Linux tomcat too many open files