Elasticsearch 快照备份还原到另一个集群

1. 当前集群开启备份,并重启服务

vim /path/elasticsearh.yml
# 写入以下内容
path.repo: /data/es_backup

2. 创建仓库

curl -H "Content-Type: application/json" -XPUT " http://192.168.1.2:9200/_snapshot/dh-snapshot" -d '
{"type":"fs","settings": {
  "location":"/data/es_backup/dinghao-snapshot",
  "compress":true
  }
}'

3. 创建快照

curl -XPUT http://192.168.21.122:9200/_snapshot/dh-snapshot/snapshot_20200309 -H 'Content-Type: application/json' -d '{
  "indices": "provider_image_v1"
}'

# 查看备份状态
curl http://192.168.21.122:9200/_snapshot/dh-snapshot/snapshot_20200309/_status?pretty

4. 在另一个集群执行1 2步骤,并将快照目录(/data/es_backup/dinghao-snapshot)拷贝到另外一台服务器,

5. 恢复快照

curl -X POST "localhost:9200/_snapshot/dh-snapshot/snapshot_20200309/_restore"

 

你可能感兴趣的:(Elasticsearch 快照备份还原到另一个集群)