2016-08-02 72 views
0

我试图从Solr 6.0将备份(迁移)索引恢复到Solr 6.1。然而,当我遵循https://cwiki.apache.org/confluence/display/solr/Making+and+Restoring+Backups的步骤,我得到一个异常错误说它失败了,当我使用是否可以将备份从Solr 6.0恢复到Solr 6.1?

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

命令检查状态。

实际响应:

<?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> 

我想这是有可能恢复从以前版本的Solr到较新的一个做备份,但是我错了?任何帮助将不胜感激。

回答

0

因此,经过几个小时的努力,我找到了解决方案。

首先,Solr回答说像下面的OK并不意味着它已经完成...(这是我的第一个错误)我使用的恢复文件已损坏(部分进行)。

<?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> 

接下来,我在看日志,和它说,它是内存不足,并保持死去,因为恢复文件是13GB大,肯定是不够用默认的Solr配置。

我重新开始的Solr与

./solr restart -m 16g 

,这是成功导入。

获得的经验:耐心,考虑记忆的大小。

1

我写了一份申请要做到这一点,它可在github:

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

的代码背后的想法很简单,当你查询使用Solrj,甚至整个集合的集合,它返回一个流文件(即SolrDocument)。 和SolrDocument实现了Map<String,Object>,Serializable

所以我想我可以在json中序列化文档。那么,看看回购,它工作得很好。