Apache solr获取(打开的文件太多)

时间:2015-06-20 06:23:24

标签: java 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后,此问题已解决。我无法确定根本原因并寻求一些帮助来解决问题。

1 个答案:

答案 0 :(得分:1)

很可能你的文件描述符用完了。运行ulimit -n以查看每个进程的当前帐户限制。

在任何基于lucene的搜索引擎上,建议增加限制。按照您的操作系统说明永久增加进程可用的文件描述符。请在此处查看其他信息: http://www.cyberciti.biz/faq/linux-increase-the-maximum-number-of-open-files/