将 Solr 索引从 6 升级到 8 [英] Upgrading Solr index from 6 to 8

查看:59
本文介绍了将 Solr 索引从 6 升级到 8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个几年前创建的内核,可以从Solr 6.x正常运行.

我已将 Solr 升级到 7.7.3.我启动了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.jarorg.apache.lucene.index.IndexUpgrader/var/solr/data/hms/data/index/ 

它默默地运行着,所以我的假设是它正确地完成了工作.

然后我已升级到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.jarorg.apache.lucene.index.IndexUpgrader/var/solr/data/hms/data/index/ 

最后一个代码退出并出现此错误:

 线程"main"中的异常;org.apache.lucene.index.IndexFormatTooOldException:不支持格式版本(资源BufferedChecksumIndexInput(MMapIndexInput(path ="/var/solr/data/hms/data/index/segments_asky")))):该索引最初是使用Lucene 6.x,当前版本为8.7.0,而Lucene仅支持读取当前和先前的主要版本.此版本的Lucene仅支持由7.0及更高版本创建的索引.在org.apache.lucene.index.SegmentInfos.readCommit(SegmentInfos.java:322)在org.apache.lucene.index.SegmentInfos.readCommit(SegmentInfos.java:291)在org.apache.lucene.index.SegmentInfos $ 1.doBody(SegmentInfos.java:461)在org.apache.lucene.index.SegmentInfos $ 1.doBody(SegmentInfos.java:458)在 org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:720)在org.apache.lucene.index.SegmentInfos $ FindSegmentsFile.run(SegmentInfos.java:672)在org.apache.lucene.index.SegmentInfos.readLatestCommit(SegmentInfos.java:463)在org.apache.lucene.index.DirectoryReader.listCommits(DirectoryReader.java:260)在org.apache.lucene.index.IndexUpgrader.upgrade(IndexUpgrader.java:158)在org.apache.lucene.index.IndexUpgrader.main(IndexUpgrader.java:78)禁止:org.apache.lucene.index.CorruptIndexException:校验和已通过(58082b0a).可能是暂时的资源问题,或者是Lucene或JVM错误(资源= BufferedChecksumIndexInput(MMapIndexInput(path ="/var/solr/data/hms/data/index/segments_asky"))))在org.apache.lucene.codecs.CodecUtil.checkFooter(CodecUtil.java:466)在org.apache.lucene.index.SegmentInfos.readCommit(SegmentInfos.java:434)...另外9个 

那是为什么?我的操作是否不正确,即先将索引从6升级到7,然后再从7升级到8?如何让我的索引与 Solr 8 一起使用?

解决方案

我已经重新创建了核心和索引,因为Solr似乎不能很好地处理过去创建的多个主要版本的索引.

I have a core which was created years ago, running correctly from a Solr 6.x.

I've upgraded Solr to 7.7.3. I've launched the IndexUpgrade script:

/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:

/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, i.e. first upgrade the index from 6 to 7 and then from 7 to 8? How can I get my index working with 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 索引从 6 升级到 8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆