简体   繁体   English

将 Solr 索引从 6 升级到 8

[英]Upgrading Solr index from 6 to 8

I have a core which was created years ago, running correctly from a Solr 6.x.我有一个多年前创建的核心,从 Solr 6.x 正确运行。

I've upgraded Solr to 7.7.3.我已将 Solr 升级到 7.7.3。 I've launched the IndexUpgrade script:我已经启动了 IndexUpgrade 脚本:

/opt/solr/server/solr-webapp/webapp/WEB-INF/lib$ sudo java -cp lucene-core-7.7.3.jar:lucene-backward-codecs-7.7.3.jar org.apache.lucene.index.IndexUpgrader /var/solr/data/hms/data/index/

It silently run, so my assumption is that it did what it had to do correctly.它默默地运行,所以我的假设是它正确地做了它必须做的事情。

Then I've upgraded to Solr 8.7.0, and launched the script:然后我升级到 Solr 8.7.0,并启动脚本:

/opt/solr/server/solr-webapp/webapp/WEB-INF/lib$ sudo java -cp lucene-core-8.7.0.jar:lucene-backward-codecs-8.7.0.jar org.apache.lucene.index.IndexUpgrader /var/solr/data/hms/data/index/

This last code exits with this error:最后一个代码退出并出现此错误:

Exception in thread "main" org.apache.lucene.index.IndexFormatTooOldException: Format version is not supported (resource BufferedChecksumIndexInput(MMapIndexInput(path="/var/solr/data/hms/data/index/segments_asky"))): This index was initially created with Lucene 6.x while the current version is 8.7.0 and Lucene only supports reading the current and previous major versions.. This version of Lucene only supports indexes created with release 7.0 and later.
    at org.apache.lucene.index.SegmentInfos.readCommit(SegmentInfos.java:322)
    at org.apache.lucene.index.SegmentInfos.readCommit(SegmentInfos.java:291)
    at org.apache.lucene.index.SegmentInfos$1.doBody(SegmentInfos.java:461)
    at org.apache.lucene.index.SegmentInfos$1.doBody(SegmentInfos.java:458)
    at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:720)
    at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:672)
    at org.apache.lucene.index.SegmentInfos.readLatestCommit(SegmentInfos.java:463)
    at org.apache.lucene.index.DirectoryReader.listCommits(DirectoryReader.java:260)
    at org.apache.lucene.index.IndexUpgrader.upgrade(IndexUpgrader.java:158)
    at org.apache.lucene.index.IndexUpgrader.main(IndexUpgrader.java:78)
    Suppressed: org.apache.lucene.index.CorruptIndexException: checksum passed (58082b0a). possibly transient resource issue, or a Lucene or JVM bug (resource=BufferedChecksumIndexInput(MMapIndexInput(path="/var/solr/data/hms/data/index/segments_asky")))
        at org.apache.lucene.codecs.CodecUtil.checkFooter(CodecUtil.java:466)
        at org.apache.lucene.index.SegmentInfos.readCommit(SegmentInfos.java:434)
        ... 9 more

Why is that?这是为什么? Am I not doing things correctly, ie first upgrade the index from 6 to 7 and then from 7 to 8?我是不是做得不对,即先将索引从 6 升级到 7,然后从 7 升级到 8? How can I get my index working with Solr 8?如何让我的索引与 Solr 8 一起使用?

I've recreated the core and the index, as Solr doesn't seem to deal well with indexes created more than one major version in the past.我重新创建了核心和索引,因为 Solr 似乎不能很好地处理过去创建的多个主要版本的索引。

I ran into this same problem, and found out that this is by design .我遇到了同样的问题,发现这是设计使然

"When we used the IndexUpgrader from Lucene 6, the Lucene version was written into the index. The recorded version was preserved by the upgrader for version 7. When the index was subsequently read by version 8, it complained because the original index was not written by version 7 or later." “当我们使用 Lucene 6 的 IndexUpgrader 时,Lucene 版本被写入索引。记录的版本被升级程序保留为版本 7。当随后版本 8 读取索引时,它抱怨原始索引没有写入版本 7 或更高版本。”

An alternative is Lucene Upgrader , but it's not very user-friendly to use.另一种选择是Lucene Upgrader ,但使用起来不是很友好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM