30-集群Backup & Restore

在 elasticsearch.yml 加入相关的配置

复制代码
#在 elasticsearch.yml 加入相关的配置
path.repo: ["/Users/zwy/es/mount/my_backup"]

创建一个 repositoty

复制代码
#创建一个 repositoty
PUT /_snapshot/my_fs_backup
{
    "type": "fs",
    "settings": {
        "location": "/Users/zwy/es/mount/my_backup",
        "compress": true
    }
}

创建一个snapshot

复制代码
# 创建一个snapshot
PUT /_snapshot/my_fs_backup/snapshot_1?wait_for_completion=true

DELETE test
PUT test/_doc/1
{
  "key":"value1"
}

指定索引创建快照

复制代码
#指定索引创建快照
PUT /_snapshot/my_fs_backup/snapshot_2?wait_for_completion=true
{
  "indices": "test",
  "ignore_unavailable": true,
  "include_global_state": false,
  "metadata": {
    "taken_by": "yiming",
    "taken_because": "backup before upgrading"
  }
}

查看所有的快照

复制代码
#查看所有的快照
GET /_snapshot/my_fs_backup/_all

# 删除快照
DELETE /_snapshot/my_fs_backup/snapshot_2


POST /_snapshot/my_fs_backup/snapshot_1/_restore
{
  
}

指定索引进行 restore

复制代码
# 指定索引进行 restore
POST /_snapshot/my_fs_backup/snapshot_1/_restore
{
  "indices": "test",
  "index_settings": {
    "index.number_of_replicas": 5
  },
  "ignore_index_settings": [
    "index.refresh_interval"
  ]
}

DELETE test

# 删除快照
DELETE /_snapshot/my_fs_backup
相关推荐
Godson_beginner7 小时前
Elasticsearch 学习笔记
java·大数据·elasticsearch·搜索引擎
用户91743965399 小时前
Elasticsearch Percolate Query使用优化案例-从2000到500ms
java·大数据·elasticsearch
CodeAmaz11 小时前
Elasticsearch Query DSL 中 must / filter / should 详解
elasticsearch
week_泽14 小时前
github_upload,上传项目
大数据·elasticsearch·github
CNRio14 小时前
Day 35:Git的分支管理:理解分支的创建、切换与合并
大数据·git·elasticsearch
CodeAmaz16 小时前
Spring Boot 项目使用 Elasticsearch 详细指南
spring boot·后端·elasticsearch
CNRio17 小时前
Day 12:Git配置详解:用户信息、编辑器、颜色等配置
git·elasticsearch·编辑器
Elastic 中国社区官方博客17 小时前
如何使用 LangChain 和 Elasticsearch 构建 agent 知识库
大数据·人工智能·elasticsearch·搜索引擎·ai·langchain·全文检索
Elastic 中国社区官方博客1 天前
使用 Elastic Cloud Serverless 扩展批量索引
大数据·运维·数据库·elasticsearch·搜索引擎·云原生·serverless