前往小程序,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 删除。

评论
登录后参与评论
暂无评论
推荐阅读
编辑精选文章
换一批
解密Docker容器网络
一个Linux容器能看见的“网络栈”,被隔离在它自己的Network Namespace中。
JavaEdge
2023/07/09
3600
解密Docker容器网络
docker网络
我们在使用 docker run 创建 Docker 容器时,可以用--net 选项指定容器的网络模式,Docker 有以下 4 种网络模式:
cuijianzhe
2022/06/14
6610
docker网络
Docker容器学习梳理--容器间网络通信设置(Pipework和Open vSwitch)
自从Docker容器出现以来,容器的网络通信就一直是被关注的焦点,也是生产环境的迫切需求。容器的网络通信又可以分为两大方面:单主机容器上的相互通信,和跨主机的容器相互通信。下面将分别针对这两方面,对容器的通信原理进行简单的分析,帮助大家更好地使用docker。前面已经在Docker容器学习梳理--基础知识(2)这一篇中详细介绍了Docker的网络配置以及pipework工具。 docker单主机容器通信 基于对net namespace的控制,docker可以为在容器创建隔离的网络环境,在隔离的网络环境下,
洗尽了浮华
2018/01/23
3.5K0
Docker容器学习梳理--容器间网络通信设置(Pipework和Open vSwitch)
浅谈容器网络
容器技术通过轻量化的资源隔离机制,极大地简化了应用部署的复杂性。而容器网络作为容器生态的核心组件,直接影响着容器间通信、服务发现及跨主机协同的能力。本文将从容器网络的基础组件出发,逐步剖析其工作原理及关键实现。
rxg456
2025/04/01
820
浅谈容器网络
docker复制文件到宿主机_下面哪几个属于docker网络模式
此种方式是将容器的某个端口映射到宿主机的某个端口,其它主机访问容器提供的服务需要通过宿主机的IP进行访问:
全栈程序员站长
2022/09/25
8170
docker复制文件到宿主机_下面哪几个属于docker网络模式
【重识云原生】第六章容器6.1.12节——Docker网络模型设计
        先来简要回顾一下前面的内容,namespace和cgroup是Linux 内核的两大特性,namespace的诞生据说就是为了支持容器技术,那么这俩特性到底干了啥呢?
江中散人_Jun
2022/09/28
4660
【重识云原生】第六章容器6.1.12节——Docker网络模型设计
深入解析容器网络
在使用kubernetes之前, 最为火热的技术就是Docker技术了。 它完成了从虚拟机时代的过度,是走向云原生时代的开端。 但是由于docker的故步自封导致被google的开源的kubernetes后来居上, 现在的Docker虽然在积极改进, 但是主流大势已经被kubernetes掌握, 所以也只能起到助力作用。 回归正题, 在kubernetes的服务发现, 服务网格等技术火热之前, 是怎么来实现容器之间的通信呢 ?本文我们就来探讨一下。
用户11097514
2024/08/05
1560
深入解析容器网络
Docker Network
docker 的网络驱动有很多种方式,docker 官网给出的网络解决方案有 6 种,分别是:bridge、host、overlay、macvlan、none、Network plugins。每个网络都有自己的特点,应用场景各不相同,例如当有多台主机上的 docker 容器需要容器间进行跨宿主机通讯时,overlay 和 macvlan 可提供解决方案,而默认 docker 采用的是 bridge 模式,此模式下不能与其他主机上的 docker 容器通讯。本篇主要关注 docker 单机通讯方式的几种通讯模式:bridge、host、none 和 container。
1ess
2021/11/01
6010
Docker Network
Docker容器中的应用是怎么跟外界通信的?
当你安装Docker时,它会自动创建三个网络,使用docker network ls命令可以列出这些网络:
Java学习录
2020/01/22
1.8K0
docker浅入深出4
带着我们就这些问题,我们来学习一下docker的网络模型,最后我会通过抓包的方式,给大家演示一下数据包在容器和宿主机之间的转换过程。
萧晚歌
2020/09/04
9530
docker浅入深出4
docker容器网络入门
尽管很多公司已经都使用k8s方便管理了各种容器应用,但作为一个容器管理者,需要了解其中网络如何运作,前面已经介绍了K8s中的网络,这里就来研究下docker容器中的网络配置。
希里安
2023/10/30
3270
docker容器网络入门
006.Docker网络管理
Docker使用Linux的Namespaces技术来进行资源隔离,如PID Namespace隔离进程,Mount Namespace隔离文件系统,Network Namespace隔离网络等。
木二
2019/07/26
1.1K0
Docker 网络模式详解及容器间网络通信
Docker本身在它创建之初,它就有自己的网络驱动器,叫Container Network Manager,简称CNM。本身这个CNM会支持多种模式,本节来看一看这些模式的区别,然后去了解一下,要让一个容器网络真正地配置好,让容器真正地模拟成一个虚拟机,我们最终要做哪些配置。
贾维斯Echo
2024/03/20
2.7K0
Docker 网络模式详解及容器间网络通信
docker容器单机网络
通过文章 容器的本质 (opens new window)可知,容器只是一个进程,而容器所能看到的网络栈,是隔离在自己的 Network Namespace (opens new window) 中。docker 容器单机网络支持四种网络模式,也都是基于 Network Namespace 实现的。本文主要是介绍这四种模式的使用方法及实现原理。
编程黑洞
2023/03/04
3670
docker容器单机网络
Docker网络
  Docker 服务默认会创建一个 docker0 网桥(其上有一个 docker0 内部接口),该桥接网络的名称为docker0,它在内核层连通了其他的物理或虚拟网卡,这就将所有容器和本地主机都放到同一个物理网络。Docker 默认指定了 docker0 接口 的 IP 地址和子网掩码,让主机和容器之间可以通过网桥相互通信。
别团等shy哥发育
2023/02/25
7030
Docker网络
大数据开发:Docker的四种网络模式详解
我们在使用docker run创建Docker容器时,可以用--net选项指定容器的网络模式,Docker有以下4种网络模式:
成都加米谷大数据
2021/02/24
1.2K0
大数据开发:Docker的四种网络模式详解
Docker网络——实现容器间通信、容器与外网通信以及容器的跨主机访问
由上图我们可以看到创建的网络ID为4554d78082da ,使用ip addr查看本机网络:
1850810
2021/06/06
16.9K0
Docker 网络配置
(1)容器间、容器与主机间的互联和通信以及端口映射 (2)容器IP变动时候,可以通过服务名直接网络通信而不受到影响
为为为什么
2024/08/01
3200
《菜农升职记》之 Docker网络
“小菜农,这个测试环境的服务器连接信息,你登上去通过docker部署下你刚刚提交的分支测试下哈!”
蔡不菜丶
2022/09/21
3580
《菜农升职记》之 Docker网络
一文读懂 Kubernetes 容器网络
在Kubernetes中要保证容器之间网络互通,网络至关重要。而Kubernetes本身并没有自己实现容器网络,而是通过插件化的方式自由接入进来。在容器网络接入进来需要满足如下基本原则:
iMike
2021/02/07
6600
相关推荐
解密Docker容器网络
更多 >
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
本文部分代码块支持一键运行,欢迎体验
本文部分代码块支持一键运行,欢迎体验