从4.7升级到7.1后的Solr索引问题

时间:2017-11-23 11:27:02

标签: java apache solr lucene

我刚刚将我们的solr从4.7升级到7.1。 我将旧文件夹名称'old_core'(包含文件夹:'index','snapshot_metadata'和'tlog')复制到数据文件夹中。 我还通过新的solr UI创建了一个新的核心。

启动solr时,我收到一条错误消息(在UI上): old_core: org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Error opening new searcher

我发现当我将子文件夹'index'从“new_core”复制到“old_core”文件夹时,它启动时没有任何错误消息。

是否意味着solr版本4.7的索引无法转移到版本7.1中? 有办法解决吗?它是安全还是可能破坏索引?

日志错误:
短:

  

引起:org.apache.lucene.index.IndexFormatTooOldException:不支持格式化版本(资源BufferedChecksumIndexInput(MMapIndexInput(path =“/ data / solr / sst1_1 / index / segments_5”))):1(需要是在6到7之间)。此版本的Lucene仅支持使用6.0版及更高版本创建的索引。

全: >

ERROR - 2017-11-23 10:05:57.182; org.apache.solr.core.CoreContainer; Error waiting for SolrCore to be created
java.util.concurrent.ExecutionException: org.apache.solr.common.SolrException: Unable to create core [sst1_1]
        at java.util.concurrent.FutureTask.report(FutureTask.java:122)
        at java.util.concurrent.FutureTask.get(FutureTask.java:192)
        at org.apache.solr.core.CoreContainer.lambda$load$14(CoreContainer.java:671)
        at com.codahale.metrics.InstrumentedExecutorService$InstrumentedRunnable.run(InstrumentedExecutorService.java:176)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor.lambda$execute$0(ExecutorUtil.java:188)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.solr.common.SolrException: Unable to create core [sst1_1]
        at org.apache.solr.core.CoreContainer.createFromDescriptor(CoreContainer.java:1045)
        at org.apache.solr.core.CoreContainer.lambda$load$13(CoreContainer.java:642)
        at com.codahale.metrics.InstrumentedExecutorService$InstrumentedCallable.call(InstrumentedExecutorService.java:197)
        ... 5 more
Caused by: org.apache.solr.common.SolrException: Error opening new searcher
        at org.apache.solr.core.SolrCore.<init>(SolrCore.java:989)
        at org.apache.solr.core.SolrCore.<init>(SolrCore.java:844)
        at org.apache.solr.core.CoreContainer.createFromDescriptor(CoreContainer.java:1029)
        ... 7 more
Caused by: org.apache.solr.common.SolrException: Error opening new searcher
        at org.apache.solr.core.SolrCore.openNewSearcher(SolrCore.java:2076)
        at org.apache.solr.core.SolrCore.getSearcher(SolrCore.java:2196)
        at org.apache.solr.core.SolrCore.initSearcher(SolrCore.java:1072)
        at org.apache.solr.core.SolrCore.<init>(SolrCore.java:961)
        ... 9 more
Caused by: org.apache.lucene.index.IndexFormatTooOldException: Format version is not supported (resource BufferedChecksumIndexInput(MMapIndexInput(path="/data/solr/sst1_1/index/segments_5"))): 1 (needs to be between 6 and 7). This version of Lucene only supports indexes created with release 6.0 and later.
        at org.apache.lucene.codecs.CodecUtil.checkHeaderNoMagic(CodecUtil.java:213)
        at org.apache.lucene.index.SegmentInfos.readCommit(SegmentInfos.java:305)
        at org.apache.lucene.index.SegmentInfos.readCommit(SegmentInfos.java:289)
        at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:1076)
        at org.apache.solr.update.SolrIndexWriter.<init>(SolrIndexWriter.java:119)
        at org.apache.solr.update.SolrIndexWriter.create(SolrIndexWriter.java:94)
        at org.apache.solr.update.DefaultSolrCoreState.createMainIndexWriter(DefaultSolrCoreState.java:257)
        at org.apache.solr.update.DefaultSolrCoreState.getIndexWriter(DefaultSolrCoreState.java:131)
        at org.apache.solr.core.SolrCore.openNewSearcher(SolrCore.java:2037)
        ... 12 more
ERROR - 2017-11-23 10:05:59.235; org.apache.solr.update.SolrIndexWriter; SolrIndexWriter was not closed prior to finalize(), indicates a bug -- POSSIBLE RESOURCE LEAK!!!
ERROR - 2017-11-23 10:05:59.236; org.apache.solr.update.SolrIndexWriter; Error closing IndexWriter
java.lang.NullPointerException
        at org.apache.lucene.index.IndexWriter.doFlush(IndexWriter.java:3583)
        at org.apache.lucene.index.IndexWriter.flush(IndexWriter.java:3545)
        at org.apache.lucene.index.IndexWriter.shutdown(IndexWriter.java:1272)
        at org.apache.lucene.index.IndexWriter.close(IndexWriter.java:1317)
        at org.apache.solr.update.SolrIndexWriter.close(SolrIndexWriter.java:280)
        at org.apache.solr.update.SolrIndexWriter.finalize(SolrIndexWriter.java:336)
        at java.lang.System$2.invokeFinalize(System.java:1270)
        at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:98)
        at java.lang.ref.Finalizer.access$100(Finalizer.java:34)
        at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:210)

提前致谢!
麦克

1 个答案:

答案 0 :(得分:2)

您无法在一次升级中升级多个版本。 Solr(Lucene)仅支持先前版本的索引格式,因此您可能必须单独执行每个版本。

有一个与Solr捆绑在一起的工具help you do this - the IndexUpgrader

还有a helpful script to automate migration from 4.x and onwards

与往常一样,如有必要,请备份索引。还要记住某些字段类型可能不再可用,或者字段类型已更改(并引入了可能默认启用的新功能)。

如果您可以重新编制索引,那么这是首选的升级路径。