2016-08-02 74 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中序列化文檔。那麼,看看回購,它工作得很好。