Solr4 Cloud Beta版本异常org.apache.lucene.store.AlreadyClosedException:此IndexWriter已关闭

时间:2012-09-06 14:39:53

标签: solr solrcloud

我最近从Solr 3.6更新为Solr4 Beta版。我在尝试一次又一次地更新并提交相同记录时遇到以下异常。有人可以帮忙解决这个问题???

SEVERE: org.apache.solr.common.SolrException: Error opening new searcher
    at org.apache.solr.core.SolrCore.openNewSearcher(SolrCore.java:1267)
    at org.apache.solr.core.SolrCore.getSearcher(SolrCore.java:1379)
    at org.apache.solr.core.SolrCore.getSearcher(SolrCore.java:1157)
    at org.apache.solr.update.DirectUpdateHandler2.commit(DirectUpdateHandler2.java:560)
    at org.apache.solr.update.processor.RunUpdateProcessor.processCommit(RunUpdateProcessorFactory.java:87)
    at org.apache.solr.update.processor.UpdateRequestProcessor.processCommit(UpdateRequestProcessor.java:64)
    at org.apache.solr.update.processor.DistributedUpdateProcessor.processCommit(DistributedUpdateProcessor.java:959)
    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:68)
    at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
    at org.apache.solr.core.SolrCore.execute(SolrCore.java:1656)
    at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:454)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:275)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.ha.session.JvmRouteBinderValve.invoke(JvmRouteBinderValve.java:219)
    at org.apache.catalina.ha.tcp.ReplicationValve.invoke(ReplicationValve.java:333)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1812)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
Caused by: org.apache.lucene.store.AlreadyClosedException: this IndexWriter is closed
    at org.apache.lucene.index.IndexWriter.ensureOpen(IndexWriter.java:553)
    at org.apache.lucene.index.IndexWriter.ensureOpen(IndexWriter.java:558)
    at org.apache.lucene.index.IndexWriter.nrtIsCurrent(IndexWriter.java:4061)
    at org.apache.lucene.index.StandardDirectoryReader.doOpenFromWriter(StandardDirectoryReader.java:261)
    at org.apache.lucene.index.StandardDirectoryReader.doOpenIfChanged(StandardDirectoryReader.java:240)
    at org.apache.lucene.index.StandardDirectoryReader.doOpenIfChanged(StandardDirectoryReader.java:230)
    at org.apache.lucene.index.DirectoryReader.openIfChanged(DirectoryReader.java:166)
    at org.apache.solr.core.SolrCore.openNewSearcher(SolrCore.java:1213)
    ... 30 more

1 个答案:

答案 0 :(得分:2)

在SolrConfig.xml的查询部分中增加MaxWarmingsearches的数量并将useColdSearcher设置为true。您可以在这里找到更多信息。 http://wiki.apache.org/solr/FAQ#What_does_.22exceeded_limit_of_maxWarmingSearchers.3DX.22_mean.3F

<query>
 <useColdSearcher>true</useColdSearcher>
 <maxWarmingSearchers>6</maxWarmingSearchers>
</query>

参加SolrCloud BootCamp并在那里获取Solr团队的输入后更新。

  • 如果你增加了变暖搜索者的数量,它将有助于减少上述异常,但它对搜索没有帮助。
  • 像Faceting,Grouping,Function Queries这样的搜索使用Max Warming Searchers,因此如果您看到上述异常,他们建议减少提交次数。增加maxWarmingSearchers,对你没有任何帮助。

  • 他们建议每秒提交一次。如果您计划每秒进行100次提交并希望查看实时更新,则可以通过关闭maxWarmingSearchers来实现。但如果你关闭它,像分面和分组这样的查询会花费更多时间。