I have a problem - got error for Sails js
EMFILE, Too many open files
By default the number of open files pro user in Centos is 1024. In my case this number was too small so I have to increase it.This is done with the ulimit command:
$ulimit -a # see all the kernel parameters
$ulimit -n #see the number of open files
$ulimit -n 9000 # set the number open files to 9000
$ulimit -n #see the number of open files
$ulimit -n 9000 # set the number open files to 9000
The problem with this way is that the ulimit parameter is only set currently for this command terminal and user.If you open a new tab and type again ulimit -a you will see that the number of open files is 1024.This means that after a reboot you’ll need to set the parameter again.
1. First, in order to set this options automatically you have to edit the etc/security/limits.conf file.
$sudo gedit /etc/security/limits.conf #open the file in gedit
The # means that this part is commented.The wildcard * means for all users.We need to set the nofile option meaning maximum number of open files.If you want to change the number of files of user, you should add this line in the limits.conf:
user soft nofile 9000
user hard nofile 65536
If you want to set the nofile only for superuser you just write root instead of user.
root soft nofile 9000
root hard nofile 65536
2. Second step: Added to /etc/sysctl.conf:
fs.file-max = 65536
Then re-read the sysctl.conf:
/sbin/sysctl -p
No comments:
Post a Comment