简体   繁体   English

是否可以将备份从Solr 6.0还原到Solr 6.1?

[英]Is it possible to restore backup from Solr 6.0 to Solr 6.1?

I am trying to restore backup (migrate) index from Solr 6.0 to Solr 6.1. 我试图将备份(迁移)索引从Solr 6.0还原到Solr 6.1。 However, when I follow the steps on https://cwiki.apache.org/confluence/display/solr/Making+and+Restoring+Backups , I get an Exception Error saying it failed when I use 但是,当我按照https://cwiki.apache.org/confluence/display/solr/Making+and+Restoring+Backups上的步骤进行操作时,出现异常错误,指出使用时失败

curl -XGET http://localhost:8983/solr/mycollection/replication?command=restorestatus 

command to check the status. 命令检查状态。

The actual response: 实际回应:

<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader"><int name="status">0</int><int name="QTime">0</int></lst><lst name="restorestatus"><str name="snapshotName">snapshot.20160802100744911</str><str name="status">failed</str><str name="exception">org.apache.solr.common.SolrException: Exception while restoring the backup index</str></lst>
</response>

I was thinking it is possible to restore backup made from a previous version of Solr to a newer one, but am I wrong? 我以为可以将以前版本的Solr备份还原到新版本,但是我错了吗? Any help will be greatly appreciated. 任何帮助将不胜感激。

I wrote an application to do this, it is available on github: 我编写了一个应用程序来执行此操作,可在github上找到它:

https://github.com/freedev/solr-import-export-json https://github.com/freedev/solr-import-export-json

The idea behind the code is simple, when you query a collection using the Solrj, even an entire collection, it returns a stream documents (ie SolrDocument ). 代码背后的想法很简单,当您使用Solrj查询一个集合时,甚至是整个集合,它都会返回一个流文档(即SolrDocument )。 And SolrDocument implements both Map<String,Object> , Serializable . SolrDocument实现Map<String,Object>Serializable

So I thought I could serialise the documents in json. 所以我想我可以序列化json中的文档。 Well, take a look at the repo, it works pretty well. 好吧,看看回购,它工作得很好。

So, after several hours of trying hard, I've figured out the solution. 因此,经过数小时的努力,我找到了解决方案。

First, a response from the Solr saying OK like below does not mean it's done... (That was my first mistake) The restoration file I was using was corrupt (partially made). 首先,Solr的回答说“确定如下”并不表示已完成...(那是我的第一个错误)我正在使用的恢复文件已损坏(部分制作了)。

<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader"><int name="status">0</int><int name="QTime">8</int></lst><str name="status">OK</str>
</response>

Next, I was looking at the logs, and it said that it was out of memory, and kept dying because the restore file was 13GB big and certainly wasn't enough with the default Solr configuration. 接下来,我正在查看日志,它说它已内存不足,并且一直死着,因为还原文件很大,只有13GB,对于默认的Solr配置来说肯定不够。

I restarted Solr with 我重新启动了Solr

./solr restart -m 16g

And it was successfully imported. 并且它已成功导入。

Lesson learned: be patient, and think about memory size. 获得的经验教训:要耐心,考虑一下内存大小。

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

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