PUT _snapshot/my_cos_backup
{
"type": "cos",
"settings": {
"app_id": "xxxxxxx",
"access_key_id": "xxxxxx",
"access_key_secret": "xxxxxxx",
"bucket": "xxxxxx",
"region": "ap-guangzhou",
"compress": true,
"chunk_size": "500mb",
"base_path": "/my_cos_backup",
"max_restore_bytes_per_sec":"40m",
"max_snapshot_bytes_per_sec":"40m"
}
}
bucket:COS Bucket Name,不能带 "-{appId}" 后缀。
PUT _snapshot/my_cos_backup/snapshot_1
{
"indices":"*,-.*,-ilm-*"
}
这里 indices 取值可以为单个索引 name,也可以使用通配符,多个value之间用英文逗号分割
PUT _snapshot/my_cos_backup
{
"type": "cos",
"settings": {
"app_id": "xxxxxxx",
"access_key_id": "xxxxxx",
"access_key_secret": "xxxxxxx",
"bucket": "xxxxxx",
"region": "ap-guangzhou",
"compress": true,
"chunk_size": "500mb",
"base_path": "/my_cos_backup",
"max_restore_bytes_per_sec":"40m",
"max_snapshot_bytes_per_sec":"40m"
}
}
bucket:COS Bucket Name,不能带 "-{appId}" 后缀。
POST _snapshot/my_cos_backup/snapshot_1/_restore
# 如果只想恢复部分index,也可以
POST _snapshot/my_cos_backup/snapshot_1/_restore
{
"indices":"*,-.*,-ilm-*"
}
同第二步,indices 取值可以为单个索引 name,也可以使用通配符,多个value之间用英文逗号分割
# 获取仓库列表
GET _snapshot
# 获取快照列表
GET _cat/snapshots?v
# 获取快照详情
GET _snapshot/my_cos_backup/snapshot_1
# 获取snapshot开头的快照,且按照name排序并只返回第一个
GET /_snapshot/my_cos_backup/snapshot*?size=1&sort=name
# 分页查询,使用上一步返回的next值继续查看剩余snapshot开头的快照
GET /_snapshot/my_cos_backup/snapshot*?size=1&sort=name&after=c25hcHNob3RfMSxteV9jb3NfYmFja3VwLHNuYXBzaG90XzE=
# 也可使用偏移量
GET /_snapshot/my_cos_backup/snapshot*?size=2&sort=name&offset=2
# 前缀匹配并T除不需要的snapshot,使用 "-" 来排除
GET /_snapshot/my_cos_backup/snapshot*,-snapshot_3?sort=name
# 获取排序后"snapshot_1"之后的snapshot
GET /_snapshot/my_cos_backup/*?sort=name&from_sort_value=snapshot_1
# 获取快照状态
GET _snapshot/_status
GET _snapshot/<repository>/_status
GET _snapshot/<repository>/<snapshot>/_status
# 恢复快照,根据情况自行选择所需参数
POST /_snapshot/my_cos_backup/snapshot_1/_restore?wait_for_completion=true
{
"indices": "index_1,index_2",
"ignore_index_settings":[
"index.codec",
"index.vector.algorithm"
],
"ignore_unavailable": true,
"include_global_state": false,
"rename_pattern": "index_(.+)",
"rename_replacement": "restored_index_$1",
"include_aliases": false
}
# 删除仓库
DELETE /_snapshot/my_cos_backup
# 删除快照
DELETE /_snapshot/my_cos_backup/snapshot_1
https://www.elastic.co/guide/en/elasticsearch/reference/7.17/get-snapshot-api.html
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有