Sometimes you might encounter a strange error, something that lies on the edge between Lucene and the operating system—the "too many files opened" exception. Is there something we can do about it? Yes, we can, and this recipe will show you how.
The following steps show how to deal with too many opened files:
So, for the purpose of the recipe let's assume that the header of the exception thrown by Solr looks like this:
java.io.FileNotFoundException: /use/share/solr/data/index/_1.fdx (Too many open files)
What can you do instead of pulling your hair out? First of all, this probably occurred on a Unix-/Linux-based operating system. So, let's start with setting the opened files' limit higher. To do that, you need to edit the
/etc/security/limits.conf
file of your operating system and set the following values (I assume Solr is running assolr
user):solr soft nofile 32000 solr hard nofile 32000