check current limitation:
#ulimit -n
1024
increase limitation:
#vi /etc/security/limits.conf
Add the following values in file:
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535
root soft nproc 200000
root hard nproc 200000
root soft nofile 200000
root hard nofile 200000
#vi /etc/sysctl.conf
Add the following line:
fs.file-max = 2097152
apply:
#sysctl -p
#reboot
check new limitations:
#ulimit -n
200000
Note For Docker:
if you want to execute ulimit inside unprivileged docker container you will get:
ulimit: open files: cannot modify limit: Operation not permitted
For resolving this execute below commands on docker HOST:
ulimit -l unlimited
ulimit -n 2097152
ulimit -c unlimited
Then Restart Docker Service. The Problem Solved
Note: Increase Open Files Limit Per Process
current limit:
cat /proc/<pid>/limits | grep files
change limit:
prlimit -n65535 -p pid_of_process
By: Mehdi Sadighian
Contact: mehdi.sadighian@hotmail.com
TAG: ubuntu, too many open files, increase file descriptor limitation, increase open files limit