2
我們在生產環境中使用Apache Solr,每週都會收到以下異常。Apache solr越來越多(打開的文件太多)
ERROR - 2015-06-19 00:45:02.127; org.apache.solr.common.SolrException; java.io.FileNotFoundException: /opt/solr/solr/list_activity_10_1847/data/index/_9_Lucene41_0.doc (Too many open files)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
at java.io.FileOutputStream.<init>(FileOutputStream.java:171)
at org.apache.lucene.store.FSDirectory$FSIndexOutput.<init>(FSDirectory.java:389)
at org.apache.lucene.store.FSDirectory.createOutput(FSDirectory.java:282)
at org.apache.lucene.store.NRTCachingDirectory.unCache(NRTCachingDirectory.java:247)
at org.apache.lucene.store.NRTCachingDirectory.sync(NRTCachingDirectory.java:182)
at org.apache.lucene.index.IndexWriter.startCommit(IndexWriter.java:4519)
at org.apache.lucene.index.IndexWriter.prepareCommitInternal(IndexWriter.java:2994)
at org.apache.lucene.index.IndexWriter.commitInternal(IndexWriter.java:3097)
at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:3064)
at org.apache.solr.update.DirectUpdateHandler2.commit(DirectUpdateHandler2.java:582)
at org.apache.solr.update.processor.RunUpdateProcessor.processCommit(RunUpdateProcessorFactory.java:95)
at org.apache.solr.update.processor.UpdateRequestProcessor.processCommit(UpdateRequestProcessor.java:64)
at org.apache.solr.update.processor.DistributedUpdateProcessor.doLocalCommit(DistributedUpdateProcessor.java:1707)
at org.apache.solr.update.processor.DistributedUpdateProcessor.processCommit(DistributedUpdateProcessor.java:1684)
at org.apache.solr.update.processor.LogUpdateProcessor.processCommit(LogUpdateProcessorFactory.java:157)
at org.apache.solr.handler.RequestHandlerUtils.handleCommit(RequestHandlerUtils.java:69)
at org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:78)
at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:1967)
at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:777)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:418)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:207)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1075)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:384)
刪除不需要的核心並重新啓動Solr後,此問題將暫時解決。我無法確定問題的根源,尋找永久解決方案的幫助。
不是很確定,但我已經看到這個錯誤主要是在Linux上(不涉及到solr雖然)。我不得不在/etc/security/limits.conf中增加限制並將其刪除。 – Ouney
psips重複的http://stackoverflow.com/questions/3828343/too-many-open-file-exception-while-indexin-using-solr –
至少在CentOS上,打開文件的默認限制是一個非常保守的1024 ,這對許多Solr裝置來說太小了。請按照Abhijit提供的鏈接來改變這一點。 –