elasticsearch 备份恢复步骤

1、查看仓库,

bash 复制代码
GET _snapshot

返回, 仓库名是aliyun_auto_snapshot

bash 复制代码
{
  "aliyun_auto_snapshot" : {
    "type" : "oss",
    "settings" : {
      "compress" : "true",
      "base_path" : "fb632b-1241148226163200/xxx",
      "endpoint" : "http://oss-cn-shenzhen-internal.aliyuncs.com"
    }
  }
}

2、查看当前备份文件

bash 复制代码
GET /_cat/snapshots/aliyun_auto_snapshot?v

返回

bash 复制代码
id                                      status start_epoch start_time end_epoch  end_time duration indices successful_shards failed_shards total_shards
es-xxx_20241206030009 SUCCESS 1733425210  19:00:10   1733425218 19:00:18     7.9s       4                13             0           13
es-xxx_20241207030008 SUCCESS 1733511609  19:00:09   1733511615 19:00:15     6.6s       4   

3、备份最新数据。排除系统索引。

bash 复制代码
PUT _snapshot/aliyun_auto_snapshot/aliyun_auto_snapshot_2024012121614
{"indices":"*,-.*"}

4、查看备份

bash 复制代码
GET /_cat/snapshots/aliyun_auto_snapshot?v

5、恢复备份的方法,恢复之前关闭索引(如果是增量恢复),或者清空索引数据。

bash 复制代码
POST _snapshot/aliyun_auto_snapshot/aliyun_auto_snapshot_2024012121614/_restore 
{"indices":"*,-.*","ignore_unavailable":"true"}

如果是增量恢复关闭索引的方法

bash 复制代码
POST *,-.*/_close  

如果需要把备份备份到自定义仓库中,以oss为例子,创建方法

bash 复制代码
PUT _snapshot/my_es_snapshot_from_oss/
{
    "type": "oss",
    "settings": {
        "endpoint": "oss-cn-shenzhen-internal.aliyuncs.com",
        "access_key_id": "xxx",
        "secret_access_key": "xxx",
        "bucket": "es-snapshot-qianyi",
        "compress": true,
        "chunk_size": "500mb",
        "base_path": "my_es_snapshot_from_oss/"
    }
}

加速快照恢复的方法

bash 复制代码
GET _cluster/settings?flat_settings&include_defaults


PUT _cluster/settings
{
  "persistent": {
    "cluster.routing.allocation.node_concurrent_recoveries": "4",
    "indices.recovery.max_bytes_per_sec": "100mb"
  }
}
bash 复制代码
修改分片迁移的配置,以便在rebalance或者recovery时更快恢复集群。

indices.recovery.max_bytes_per_sec:恢复时单个节点的总进出流量限制。(默认40mb)

indices.recovery.max_concurrent_file_chunks:恢复时可并发拷贝的文件块数量。(默认2)

cluster.routing.allocation.cluster_concurrent_rebalance:整个集群范围内允许同时rebalance的shard数。(默认2)

cluster.routing.allocation.node_initial_primaries_recoveries:单个节点主分片并行恢复的数据。(默认4)

cluster.routing.allocation.node_concurrent_recoveries:单个节点允许同时接收、传出恢复的shard数,(默认2)
相关推荐
LSL666_2 小时前
5 Repository 层接口
android·运维·elasticsearch·jenkins·repository
武汉唯众智创6 小时前
高职院校大数据软件教学实训室建设方案
大数据·大数据实训室·大数据实验室·大数据软件教学实训室·大数据教学实训室
Elastic 中国社区官方博客6 小时前
Elasticsearch:如何为 Elastic Stack 部署 E5 模型 - 下载及隔离环境
大数据·数据库·人工智能·elasticsearch·搜索引擎·ai·全文检索
qqxhb6 小时前
系统架构设计师备考第68天——大数据处理架构
大数据·hadoop·flink·spark·系统架构·lambda·kappa
思通数科多模态大模型7 小时前
扑灭斗殴的火苗:AI智能守护如何为校园安全保驾护航
大数据·人工智能·深度学习·安全·目标检测·计算机视觉·数据挖掘
high20117 小时前
【Git】-- Rebase 减少 Commit 次数指南
大数据·git·elasticsearch
Ace_31750887767 小时前
淘宝店铺全量商品接口实战:分类穿透采集与增量同步的技术方案
大数据·数据库·python
失散138 小时前
分布式专题——51 ES 深度分页问题及其解决方案详解
java·分布式·elasticsearch·架构
盈飞无限9 小时前
质量智能革命:SPC软件助力中国制造驶入高质量发展快车道
大数据·人工智能·制造
wufeng无峰9 小时前
谷歌浏览器Google Chrome离线安装包
chrome·离线安装包