How to raise the nofiles limit on *NIX
ElasticSearch needs to keep lots of files open simultaneously and you will need to raise the maximum number of open files a user can have.
In this tutorial, we will assume that you are running ElasticSearch
as the user elasticsearch
.
To raise the limit add to /etc/security/limits.conf
the lines:
elasticsearch soft nofile 32000 elasticsearch hard nofile 32000
Now you can check if these limits have been applied running:
sudo -u elasticsearch -s "ulimit -Sn"
If you are logged in as elasticsearch
you have to log out and log
in again to see the new limits.
If you still see the previous limit, run:
egrep -r pam_limits /etc/pam.d/
and check that all pam_limits.so are not commented out.
You can check the limit that elasticsearch really has adding the flag
es.max-open-files=true
, for example:
$ bin/elasticsearch -f -Des.max-open-files=true [2011-04-05 04:12:02,687][INFO ][bootstrap ] max_open_files [32000]
If sudo -u elasticsearch -s "ulimit -Sn"
shows 32000 but you
still have a low limit when you run ElasticSearch, you're probably running it
through another program that doesn't support PAM: a frequent offender is
supervisord
.
The only solution I know to this problem is to raise the nofile
limit for the user running supervisord
, but this will obviously raise the limit
for all the processes running under supervisord
, not an ideal situation.
Consider using the ElasticSearch service wrapper instead.
blog comments powered by Disqus