"Too many open files" while dumping data to elasticsearch "Too many open files" while dumping data to elasticsearch elasticsearch elasticsearch

"Too many open files" while dumping data to elasticsearch


Ok - if you are running multiple elasticsearch nodes plus node.js apps on a single Mac I'd definitely make certain that your number of open files is bumped to the limits that ES recommends:

file descriptorMake sure to increase the number of open files descriptors on the machine (or for the user running elasticsearch). Setting it to 32k or even 64k is recommended.In order to test how many open files the process can open, start it with -Des.max-open-files set to true. This will print the number of open files the process can open on startup.Alternatively, you can retrieve the max_file_descriptors for each node using the Nodes Info API, with:curl localhost:9200/_nodes/process?pretty

You need to make certain this is done for the user running ES, not just root (unless of course you are running it as root).

To do this I'd follow these directions: (http://elasticsearch-users.115913.n3.nabble.com/quot-Too-many-open-files-quot-error-on-Mac-OSX-td4034733.html). Assuming you want 32k and 64k as the limits:

In /etc/launchd.conf put:limit maxfiles 32000 64000Make sure in your ~/.bashrc file you are not setting the ulimit with something like "ulimit -n 1024".  Open a new terminal, and run:launchctl limit maxfilesulimit -a

Don't forget to restart after you make these changes. Then when you start elasticsearch pass in this command line parameter:

elasticsearch -XX:-MaxFDLimit

After the above steps on my Mac I'm getting the following response from Elasticsearch:

curl http://localhost:9200/_nodes/process?pretty{  "cluster_name" : "elasticsearch",  "nodes" : {    "XXXXXXXXXXXXXXXXXXXXXXX" : {      "name" : "Marrina Smallwood",      "transport_address" : "inet[XX.XX.XX.XX:9300]",      "host" : "MacBook-Pro-Retina.local",      "ip" : "XX.XX.XX.XX",      "version" : "1.1.1",      "build" : "f1585f0",      "http_address" : "inet[/XX.XX.XX.XX:9200]",      "process" : {        "refresh_interval" : 1000,        "id" : 538,        "max_file_descriptors" : 32768,        "mlockall" : false      }    }  }}