Elasticsearch索引的备份及恢复

1、    编辑ElasticSearch配置文件(elasticsearch.yml文件),添加如下内容:

path.repo: ["/tmp/back","/home/back"]              #可以添加多个路径


2、    进入sense插件页面,输入如下命令,创建备份存储的仓库:

PUT http://192.168.0.44:9200/_snapshot/backup
{
  "type": "fs",
  "settings": {
    "location": "/tmp/back"
  }
}


3、    输入下面的命令备份索引:

PUT http://192.168.0.44:9200/_snapshot/backup/snapshot_1?wait_for_completion=true
{
  "indices":"backupindex"
}


4、    输入下面的命令恢复索引:

POST http://192.168.0.44:9200/_snapshot/backup/snapshot_1/_restore
{
  "indices":"backupindex"
}


5、    说明:如果需要异地恢复,则需要在异地创建备份仓库,同时拷贝备份文件过去。



你可能感兴趣的:(elasticsearch,elasticsearch,备份,索引)