首页 > elasticsearch的备份和恢复(转)

elasticsearch的备份和恢复(转)

vim /etc/elasticsearch/elasticsearch.yml 
path.repo: ["/data/backups/es_backup"]    #备份目录,根据自己情况进行填写
systemctl restart elasticsearch.service 
mkdir -pv /data/backups/es_backup 
chmod 755 /data/backups/es_backup
chown elasticsearch:elasticsearch /data/backups/es_backup

2、创建仓库

备份数据之前,要创建一个仓库来保存数据,仓库的类型支持Shared filesystem, Amazon S3, HDFS和Azure Cloud。下面以文件系统为例

curl -H "Content-Type:application/json" -XPUT '127.0.0.1:9200/_snapshot/es_backup' -d '
{"type": "fs", "settings": {"location": "/data/backups/es_backup" }
}'

3、备份索引

curl -H "Content-Type:application/json" -XPUT '127.0.0.1:9200/_snapshot/es_backup/snapshot_1'

如果只想备份部分索引的话,可以加上indices 参数:

 

curl -H "Content-Type:application/json" -XPUT '127.0.0.1:9200/_snapshot/es_backup/snapshot_2' -d '
    {"indices": "index_1,index_2"}'

5 、查看备份信息

curl -H "Content-Type:application/json" -XGET '127.0.0.1:9200/_snapshot/es_backup/snapshot_1?pretty=true'
{ 

 

参考:https://www.jianshu.com/p/3b4d869f2fd1

参考:https://blog.csdn.net/jiahao1186/article/details/81058022

6、数据恢复

curl -H "Content-Type:application/json" -XPOST '127.0.0.1:9200/_snapshot/es_backup/snapshot_1/_restore'

 

转载于:https://www.cnblogs.com/hixiaowei/p/11296854.html

更多相关:

  • 安装新的int 9中断例程(按'A'键后显示满屏幕的'A') int 9 是外中断,同样,程序编写还是和其他中断例程类似,安装(复制),调用; 不同点是在于,他要从端口读取数据60h, Source Code : assume cs:codestack segmentdb 128 dup(0) stack endscode segm...