ElasticSearch 数据快照备份(不同版本)
https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.htmlElasticsearch版本升级到1.7,老版本1.4
备份有三种
1.直接cp文件
2.dump
3.程序逻辑
这里不同版本直接cp文件的方式不行,选择dump快照
1)创建快照存储库
默认就是压缩的
curl -XPUT 127.0.0.1:9200/_snapshot/backup -d '
{
"type":"fs",
"compress":"true",
"settings":{"location":"/home/elasticsearch/snapshot"}
}'
2)然后创建快照
curl -XPUT 127.0.0.1:9200/_snapshot/backup/$filename?wait_for_completion=true&pretty
3)恢复快照
curl -XPOST 127.0.0.1:9200/_snapshot/backup/$filename/_restore
$filename自己取名
4)查询运行状态
curl -XGET 127.0.0.1:9200/_snapshot/_status
5)查看restore状态
http://192.168.232.14:9200/_plugin/head/,看index的数据大小变化和节点状态
6)用snapshot还原的数据可能存在number_of_replicas为0的情况,可以更新index的setting
curl -XPUT 'localhost:9200/my_index/_settings'-d '{"index":{"number_of_replicas": 1}}'
页:
[1]