Solr Cloud 备份

-------备份SolrCloud------------------------

创建备份,默认为snapshot.<name>:

http://172.28.5.32:11010/solr/activity_shard1_replica1/replication?command=backup

 

删除名字为 [snapshot.20141111133105714]的备份,注意20141111133105714才是name,前面的snapshot.不算:

http://172.28.5.32:11010/solr/activity_shard1_replica1/replication?command=deletebackup&name=20141111133105714

 

创建 name为[2014-11-11_15-37],保留最近的5个备份[numberToKeep=5],存储位置为指定位置[location=]

http://172.28.5.32:11010/solr/activity_shard1_replica1/replication?command=backup&name=2014-11-11_15-37&numberToKeep=5&location=/home/java1/programs/data/SolrBackUp/SolrSlave1/activity_shard1_replica1/data/

 

删除 name为[2014-11-11_15-37],存储位置为指定位置[location=]

http://172.28.5.32:11010/solr/activity_shard1_replica1/replication?command=deletebackup&name=2014-11-11_15-37&location=/home/java1/programs/data/SolrBackUp/SolrSlave1/activity_shard1_replica1/data/

 

查看复制详细信息:

http://172.28.5.32:11010/solr/activity_shard1_replica1/replication?command=details

 

<1>:备份方式:

使用/replication?command=backup方式备份,且为每一个core进行备份.

 

<2>: 还原方式1:

  1. Stop the Solr server. 
  2. Copy a backup index to the data directory for each core. Remember to use a backup created from the same Alfresco instance.
  3. Restart the Solr server. Solr will start to track the indexes based on the state of the restored index.

<3>: 还原方式2:

数据目录中的index.properties中的内容: (例如: /usercard_shard1_replica3/data/index.properties)

index=index.20141110200201428

停止solr,将index=改为目标加载目录名称

即可,如果没有index.properties, 默认会加载 index 文件中的内容

参考1:http://stackoverflow.com/questions/7593184/change-solr-search-directory-to-my-custom-named-index-directory

You can also use the index.properties file to point to which directory Solr loads. It goes in the data directory and it has a index property pointing to the directory name to be used instead of 'index'

That's worked for me without issue. I believe this was done to help make replication work seamlessly.

 

参考2:http://blog.csdn.net/duck_genuine/article/details/6165314

 

对于下载文件内容,对应命令是filecontent。下载的文件显然需要放到临时目录中,这个临时目录和已有的索引目录(默认名字index)在同一数据目录下,只是命名为index.<时间戳>。下载完毕后,copy数据有两种情况:1)如果是完全下载,则不需要将临时目录中的文件copy到已有目录中,而是修改数据目录中的index.properties,标识索引目录为新生成的临时目录,而旧索引目录并不会被删除,可以手工删掉,当然,通常是不应该出现slave的Generation大于master的异常情况。2)通常就是把临时索引目录的文件copy到旧索引目录,copy时要把segments_N放到最后copy,避免copy中途出现异常造成数据被毁。

 

 

 

--------------------------------------------

 

没有Solr数据备份时,且 全部都down掉且recovery不过来时, 挑一个数据较全的主Shard节点,然后把这个shard节点的其它副本从SolrCloud通过curl方式去掉,然后再通过curl方式加上,SolrCloud会自动将这个Shard的主节点数据同步到刚才加上的从节点

 

猜你喜欢

转载自rayoo.iteye.com/blog/2154584
今日推荐