前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >专栏 >腾讯云 Elasticsearch Service COS快照恢复常见问题及解决方案

腾讯云 Elasticsearch Service COS快照恢复常见问题及解决方案

原创
作者头像
zjiekou
发布于 2023-12-06 15:51:14
发布于 2023-12-06 15:51:14
1.1K00
代码可运行
举报
文章被收录于专栏:大数据zjiekou大数据zjiekou
运行总次数:0
代码可运行

一、前言

用户在腾讯云上自建的 ES 集群或者在其它云厂商购买的 ES 集群,如果要迁移至腾讯云 ES(适用于大部分普通索引迁移),用户可以根据自己的业务需要选择合适的迁移方案。如果业务可以停服或者可以暂停写操作,可以使用以下几种方式进行数据迁移

  1. COS 快照
  2. logstash
  3. elasticsearch-dump 具体实践可参考官网文档:https://cloud.tencent.com/document/product/845/35568

二、常见报错场景

1、创建repository 仓库报错my_cos_backup path is not accessible on master node

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
{
  "error" : {
    "root_cause" : [
      {
        "type" : "repository_verification_exception",
        "reason" : "[my_cos_backup] path  is not accessible on master node"
      }
    ],
    "type" : "repository_verification_exception",
    "reason" : "[my_cos_backup] path  is not accessible on master node",
    "caused_by" : {
      "type" : "i_o_exception",
      "reason" : "Exception when write blob master.dat",
      "caused_by" : {
        "type" : "cos_service_exception",
        "reason" : "cos_service_exception: The specified bucket does not exist. (Status Code: 404; Error Code: NoSuchBucket; Request ID: NjUzYzkwYmRfMzAxNzUyMWVfMjJmYmNfYTJkOGY1Ng==); Trace ID: OGVmYzZiMmQzYjA2OWNhODk0NTRkMTBiOWVmMDAxODc1NGE1MWY0MzY2NTg1MzM1OTY3MDliYzY2YTQ0ZThhMDFhOWZlZTQxMzRkMTQ2NGM4MmFlZDk1MTQzM2UyMTll"
      }
    }
  },
  "status" : 500
}

报错原因:bucket和app_id参数入参有误,bucket经常会有客户把桶appid完整复制上导致出错、app_id填成UIN也会有这个问题。

解决方案:

bucket:COS Bucket 名字,不带 appId 后缀的 bucket 名

app_id:腾讯云账号 APPID

二、cos快照恢复集群red,"explanation": "node does not match index setting index.routing.allocation.require filters temperature:\"hot\""

报错原因:通常是由于客户将热节点的集群通过cos快照迁移到温节点的集群会出现这个问题,这个意思是说用户在目标集群恢复的时候 因为磁盘属性不同,导致数据恢复失败。 做快照的集群是ssd的,SSD磁盘的数据节点默认是hot属性的, 需要恢复的集群时高性能云硬盘,高性能云盘的数据节点默认是warm属性的 。从hot节点集群恢复到warm节点集群就会出现这个冲突异常。

解决方案:

先删除之前恢复的索引,然后在恢复的命令中,加以下相关参数

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
POST _snapshot/cos_backup/snapshot_名称/_restore
{
  "indices": "*,-.monitoring*,-.security*,-.kibana*",
  "ignore_unavailable": true,
  "ignore_index_settings": [
    "index.routing.allocation.require.temperature"
  ]
}

三、ES 8.8.1版本创建仓库报错{"error":{"root_cause":[{"type":"repository_exception","reason":"my_cos_repository No region defined for cos repository"}],"type":"repository_exception","reason":"my_cos_repository failed to create repository","caused_by":{"type":"repository_exception","reason":"my_cos_repository No region defined for cos repository"}},"status":500}

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
curl -u 'elastic:xxxx' -X PUT 'http://xxxxx:9200/_snapshot/my_cos_repository' -H "Content-Type: application/json" -d ' 
{ 
  "type": "cos", 
  "settings": { 
    "bucket": "xxx", 
    "region": "ap-shanghai", 
    "access_key_id": "XXX", 
    "access_key_secret": "XXX", 
    "base_path": "/", 
    "app_id": "xxxx" 
  } 
} 
' 

解决方案:

8.8.1版本需要这样创建

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
PUT _snapshot/my_cos_backup
{
  "type": "cos",
  "settings": {
    "compress": true,
    "chunk_size": "500mb",
    "cos": {
      "client": {
        "app_id": "xxxx",
        "access_key_id": "xxxx",
        "access_key_secret": "xxxx",
        "bucket": "xxxx",
        "region": "ap-guangzhou",
        "base_path": "/"
      }
    }
  }
}

四、快照恢复报错

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "Alias [.kibana] has more than one indices associated with it [[.kibana_2_backup, .kibana_1]], can't execute a single index op: [illegal_argument_exception] Alias [.kibana] has more than one indices associated with it [[.kibana_2_backup, .kibana_1]], can't execute a single index op"
}

解决方案:

恢复ES备份的时候,把源集群的.kibana_1和.kibana_2也复制过来了,这个.kibana_2的别名是.kibana。导致冲突了。

首先移除.kibana_2别名

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
POST _aliases
{
  "actions": [
    {
      "remove": {
        "index": ".kibana_2",
        "alias": ".kibana"
      }
    }
  ]
}

关闭索引自动创建

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
PUT _cluster/settings
{
  "persistent": {
    "action.auto_create_index": false
  }
}

操作完成后重新进行恢复数据操作

多可用区集群增量恢复报错

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
{"unassigned_info":{"reason":"EXISTING_INDEX_RESTORED","details":"restore_source[my_cos_backup/snapshot_2]"},"node_allocation_decisions":[{"deciders":[{"explanation":"there are too many copies of the shard allocated to nodes with attribute [set], there are [3] total configured shard copies for this shard id and [3] total attribute values, expected the allocated shard count per attribute [2] to be less than or equal to the upper bound of the required number of shards per attribute [1]"}]},{"deciders":[{"explanation":"there are too many copies of the shard allocated to nodes with attribute [set], there are [3] total configured shard copies for this shard id and [3] total attribute values, expected the allocated shard count per attribute [2] to be less than or equal to the upper bound of the required number of shards per attribute [1]"}]},{"deciders":[{"explanation":"there are too many copies of the shard allocated to nodes with attribute [set], there are [3] total configured shard copies for this shard id and [3] total attribute values, expected the allocated shard count per attribute [2] to be less than or equal to the upper bound of the required number of shards per attribute [1]"}]},{"deciders":[{"explanation":"there are too many copies of the shard allocated to nodes with attribute [set], there are [3] total configured shard copies for this shard id and [3] total attribute values, expected the allocated shard count per attribute [2] to be less than or equal to the upper bound of the required number of shards per attribute [1]"}]},{"deciders":[{"explanation":"the shard cannot be allocated to the same node on which a copy of the shard already exists [[sel_pitem_his][2], node[Tg4tV6mcT22SO_0ZCfWHWA], [R], s[STARTED], a[id=X7H-v4fRQTaWnOPsu3j7KA]]"},{"explanation":"there are too many copies of the shard allocated to nodes with attribute [set], there are [3] total configured shard copies for this shard id and [3] total attribute values, expected the allocated shard count per attribute [2] to be less than or equal to the upper bound of the required number of shards per attribute [1]"}]},{"deciders":[{"explanation":"the shard cannot be allocated to the same node on which a copy of the shard already exists [[sel_pitem_his][2], node[b2RSlGbNR82IU_1j1HShJw], [P], s[STARTED], a[id=UXIVucaDQkyNSQ5syzrkwA]]"},{"explanation":"there are too many copies of the shard allocated to nodes with attribute [set], there are [3] total configured shard copies for this shard id and [3] total attribute values, expected the allocated shard count per attribute [2] to be less than or equal to the upper bound of the required number of shards per attribute [1]"}]}]}

解决方案:

方案一

结合集群环境,计算副本数目

不需要调整的副本数目需要用以下公式计算:

ceil{(replicas + 1) / (可用区+1)} = ceil{(replicas + 1) / 可用区}

repilcas <= 总节点数 -1

以2可用区,单可用区3节点为例

replicas可用值为:0,1,3

然后获取集群所有索引分片数目,如果和上述结果不一致,则挂起

方案二

换一个思路,分片迁移出现异常是由于awareness.attributes 中set属性限制导致,流程执行到checkScaleInCvmCluster后,执行如下命令:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
PUT _cluster/settings
{
  "persistent": {
    "cluster.routing.allocation.awareness.attributes": "ip"
  },
  "transient": {
    "cluster.routing.allocation.awareness.attributes": "ip"
  }
}

执行完上述命令后,卡住的分片随后会自动迁移,并且老的可用区节点自动下线, "cluster.routing.allocation.awareness.attributes": "ip"会自动还原为 "cluster.routing.allocation.awareness.attributes" : "set,ip"

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
暂无评论
推荐阅读
编辑精选文章
换一批
腾讯云ES集群通过COS实现跨地域备份与恢复
在日常开发及运维工作中,我们经常会遇到一些内外部的客户希望将不同地域的es集群迁移到另外一个地域。例如有的客户es集群原来是在北京地域,由于一些原因,现在想要将集群迁移到上海地域来。下面我们就详细介绍下借助腾讯云COS和es的snapshot功能来实现跨地域的数据迁移。
吴容
2020/07/29
2.7K1
腾讯云ES集群通过COS实现跨地域备份与恢复
还在为ES集群Red/Yellow烦恼?带你进行场景拆解
背景:业务在使用ES过程中频繁遇到集群Yellow或Red的场景,若对于ES不是很了解,针对繁多的异常场景经常无从下手。本文重点列举了一下健康值异常时的排查方式以及从代码中梳理了常见的问题场景。
ES小助理
2022/12/08
3.2K0
还在为ES集群Red/Yellow烦恼?带你进行场景拆解
Elasticsearch shard 分配感知
官方文档:https://www.elastic.co/guide/en/elasticsearch/reference/7.2/allocation-awareness.html
HLee
2020/12/16
2.1K0
Elasticsearch shard 分配感知
腾讯云ES集群通过COS实现跨地域备份与恢复
在日常开发及运维工作中,我们经常会遇到一些内外部的客户希望将不同地域的es集群迁移到另外一个地域。例如有的客户es集群原来是在北京地域,由于一些原因,现在想要将集群迁移到上海地域来。下面我们就详细介绍下借助腾讯云COS和es的snapshot功能来实现跨地域的数据迁移。
腾讯云大数据
2021/01/08
1.2K0
腾讯云ES集群通过COS实现跨地域备份与恢复
通过COS快照从自建ES迁移至腾讯云最佳实践
作者介绍 万守兵:腾讯云行业架构师,对云上双活架构、迁移方案有比较深的了解,现主要负责腾讯云泛互行业TOP级客户的解决方案架构工作。 一 场景介绍 在腾讯云同一个VPC内使用3台CVM部署自建ES集群,可以通过给自建Elasticsearch打快照存储到COS,在利用COS中的快照进行数据库恢复,将自建Elasticsearch数据迁移至腾讯云Elasticsearch。 腾讯云 Elasticsearch Service(ES)是基于开源搜索引擎 Elasticsearch 打造的高可用、可
云存储
2020/06/29
1.9K1
Elasticsearch 数据离线迁移方案(含冷热分层场景)
本文描述问题及解决方法同样适用于 腾讯云 Elasticsearch Service(ES)。
岳涛
2023/06/13
3.3K0
Elasticsearch 数据离线迁移方案(含冷热分层场景)
Elasticsearch源码分析六之AllocationDeciders
上面的图为类继承关系图的一部分,下面针对具体的配置进行分析。本文及本系列源码都是针对es的7.5.1版本。Shard Allocation,Shard Move,Shard Rebalance会利用这些Decider,再决定是否进行分片分配,分片迁移,分片均衡等操作。
山行AI
2020/03/10
1.5K0
腾讯云Elasticsearch集群运维常用命令详解一(集群篇)
腾讯云Elasticsearch Service产品提供了一种全托管的云端服务,客户可以在腾讯云控制台一键创建集群、轻松管理集群,以及高度灵活的弹性变配模式。因此,使用腾讯云ES,您可以快速部署、按需扩展您的集群,简化复杂运维工作,快速构建日志分析、异常监控、网站搜索、企业搜索、BI分析等各类业务。同时腾讯云ES团队也提供了高度专业的平台管控、内核开发及集群运维能力。本文将从集群运维角度出发,分享我们日常工作中帮客户运维集群时常用到的一些命令,以及各命令适用的场景。
吴容
2021/12/05
5K0
腾讯云Elasticsearch集群运维常用命令详解一(集群篇)
【最佳实践】巡检项:Elasticsearch Service(ES)集群健康值
文档中涉及到的所有 DSL 命令,都可以通过 kibana 的 dev tools 执行
shanizeng
2022/04/01
4.3K0
《Elasticsearch 源码解析与优化实战》第12章:allocation模型分析
本文主要分析allocation 模块的结构和原理,然后以集群启动过程为例分析 allocation 模块的工作过程
HLee
2021/05/27
1.1K1
《Elasticsearch 源码解析与优化实战》第12章:allocation模型分析
自建ES集群迁移至腾讯云ES的几种方案介绍
随着腾讯云Elasticsearch产品功能越来越丰富、产品体验越来越好。越来越多的客户将自建的ES集群或者部署在其他云厂商的 ES 集群迁移到腾讯云上来。为了更加方便快捷地帮助客户完成集群迁移工作,下面简单介绍下可提供的两种迁移方案,离线迁移和在线迁移。
吴容
2020/07/28
4.2K0
自建ES集群迁移至腾讯云ES的几种方案介绍
【玩转腾讯云】通过COS快照从自建ES迁移至腾讯云最佳实践
在腾讯云同一个VPC内使用3台CVM部署自建ES集群,可以通过给自建Elasticsearch打快照存储到COS,在利用COS中的快照进行数据库恢复,将自建Elasticsearch数据迁移至腾讯云Elasticsearch。
Vicwan
2020/04/08
3.1K0
Elasticsearch集群Shard Allocation机制
    Elasticsearch由一些Elasticsearch进程(Node)组成集群,用来存放索引(Index)。为了存放数据量很大的索引,Elasticsearch将Index切分成多个分片(Shard),在这些Shard里存放一个个的文档(document)。通过这一批shard组成一个完整的index。并且,每个Shard可以设置一定数量的副本(Replica),写入的文档同步给副本Shard,副本Shard可以提供查询功能,分摊系统的读负载。在主Shard所在Node(ES进程)挂掉后,可以提升一个副本Shard为主Shard,文档继续写在新的主Shard上,来提升系统的容灾能力。
技术姐
2018/09/11
1.8K0
Elasticsearch集群Shard Allocation机制
PB级大规模Elasticsearch集群运维与调优实践
某中型互联网公司的游戏业务,使用了腾讯云的Elasticsearch产品,采用ELK架构存储业务日志。因为游戏业务本身的日志数据量非常大(写入峰值在100w qps),在服务客户的几个月中,踩了不少坑,经过数次优化与调整,把客户的ES集群调整的比较稳定,避免了在业务高峰时客户集群的读写异常,并且降低了客户的资金成本和使用成本。下面把服务客户过程中遇到的典型问题进行梳理,总结经验,避免再次踩坑。
bellen
2020/07/24
1.9K0
PB级大规模Elasticsearch集群运维与调优实践
解决Elasticsearch分片未分配的问题「译」
在Elasticsearch中,健康的群集是一个平衡的群集:主分片和副本分布在所有节点上,以保证有节点故障时的持久可靠性。
后场技术
2020/09/03
7.9K0
解决Elasticsearch分片未分配的问题「译」
3.5.9 Shard Allocation
分片分配 (shard allocation),是指在索引创建、副本增减、节点增减、分片重平衡等过程将索引分片落实到实际的物理节点的操作,包括但不限于:
tiaotiaoba
2021/07/14
9160
Elasticsearch 集群状态变成黄色或者红色,怎么办?
这是系列文章的第六篇,主要探讨:Elasticsearch 集群状态变成黄色或者红色,怎么办?
铭毅天下
2022/04/06
1.9K0
Elasticsearch 集群状态变成黄色或者红色,怎么办?
Elasticsearch 可搜索快照技术原理及最佳实践
Elasticsearch于7.10版本推出可搜索快照功能,但是7.10版本的可搜索快照技术还不够成熟,随着7.14版本的发布,可搜索快照技术才真正能够大规模用于生产实践中。本文将基于ES 7.14.2版本,继续从原理和实践两个角度向大家介绍可搜索快照技术。
腾讯云大数据
2021/12/29
1.4K1
Elasticsearch 可搜索快照技术原理及最佳实践
解决elasticsearch集群Unassigned Shards无法reroute的问题
接上篇文章https://blog.csdn.net/dhaibo1986/article/details/107564968 在上一篇文章中,由于系统宕机,导致大量索引出现了Unassigned 状态。在上一篇文章中,我们通过reroute API进行了操作,对主分片缺失的索引,经过上述操作之后,分配了主分片。但是在接下来的操作中,对于副本分片,reroute出错! 如下是索引 alarm-2017.08.12,第0个分片的副本没有分配:
冬天里的懒猫
2020/08/03
3.7K0
Elasticsearch可搜索快照技术原理及最佳实践
Elasticsearch于7.10版本推出可搜索快照功能,但是7.10版本的可搜索快照技术还不够成熟,随着7.14版本的发布,可搜索快照技术才真正能够大规模用于生产实践中。本文将基于ES 7.14.2版本,继续从原理和实践两个角度向大家介绍可搜索快照技术的。
吴容
2021/11/27
2.1K3
Elasticsearch可搜索快照技术原理及最佳实践
推荐阅读
相关推荐
腾讯云ES集群通过COS实现跨地域备份与恢复
更多 >
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档