首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用方案、主机和白名单从远程集群问题重新索引AWS ElasticSearch

使用方案、主机和白名单从远程集群问题重新索引AWS ElasticSearch
EN

Stack Overflow用户
提问于 2020-04-27 20:22:43
回答 4查看 4.1K关注 0票数 2

背景:

  • 我们在同一个AWS帐户和区域中有两个版本6.8的AWS ElasticSearch集群。
  • 我们需要将其中一个索引从集群1(源)重新索引到集群2 (dest)。

我尝试为6.8使用reindex API,如ES文件中所述

代码语言:javascript
复制
POST <https://endpoint of destination Elasticsearch>/_reindex 

    {
      "source": {
        "remote": {
          "host": "https://endpoint-of-source-elasticsearch-cluster-1.es.amazonaws.com"
        },
        "index": "source-index-name"
      },
      "dest": {
        "index": "destination-index-name"
      }
    }

问题:

我的错误越来越少

代码语言:javascript
复制
{
    "error": {
        "root_cause": [
            {
                "type": "x_content_parse_exception",
                "reason": "[8:3] [reindex] failed to parse field [source]"
            }
        ],
        "type": "x_content_parse_exception",
        "reason": "[8:3] [reindex] failed to parse field [source]",
        "caused_by": {
            "type": "illegal_argument_exception",
            "reason": "[host] must be of the form [scheme]://[host]:[port](/[pathPrefix])? but was [https://endpoint-of-source-elasticsearch-cluster-1.es.amazonaws.com]",
            "caused_by": {
                "type": "u_r_i_syntax_exception",
                "reason": "The port was not defined in the [host]: https://endpoint-of-source-elasticsearch-cluster-1.es.amazonaws.com"
            }
        }
    },
    "status": 400
}

可能的原因:

  1. 主机参数必须按照文档包含一个方案、主机、端口(例如https://otherhost:9200)。
  2. 远程主机必须使用elasticsearch.yaml属性显式地在reindex.remote.whitelist中白名单。

由于我使用的是AWS集群,所以我不知道如何遵循主机、post或如何白名单集群的方案,因为我不知道如何在AWS集群上进行这些更改。

请求帮助,如果有任何解决办法。谢谢,

EN

回答 4

Stack Overflow用户

发布于 2020-05-05 09:33:06

不幸的是,在able中,您将无法修改静态配置设置,比如reindex.remote.whitelist参数,因为要配置reindex.remote.whitelist参数需要修改elasticsearch.yml文件。这是因为AWS管理的服务,目前还没有一种方式让客户访问OS/文件系统。

作为替代方案,

  1. 您可以获取上一个域的手动快照并将其还原为新域。与来自远程的重新索引相比,这种方法一次只影响一个域,即截取快照的域或还原快照的域。
  2. 您还可以将洛格斯塔什与Elasticsearch、输入输出插件一起使用,从原始域中的索引中读取数据,并将其索引到任何其他/索引域中。
票数 7
EN

Stack Overflow用户

发布于 2020-11-28 20:08:51

AWS Elasticsearch v7.9现在支持远程重新索引,只需发出一个reindex命令,例如:

代码语言:javascript
复制
POST <local-domain-endpoint>/_reindex
{
  "source": {
    "remote": {
      "host": "https://remote-domain-endpoint:443"
    },
    "index": "remote_index"
  },
  "dest": {
    "index": "local_index"
  }
}

必须在远程域终结点添加443以进行验证检查。

若要验证索引是否已复制到本地域,请执行以下操作:

代码语言:javascript
复制
GET <local-domain-endpoint>/local_index/_search

如果远程索引位于与本地域不同的区域,则传递其区域名称,如在此示例请求中:

代码语言:javascript
复制
POST <local-domain-endpoint>/_reindex
{
  "source": {
    "remote": {
      "host": "https://remote-domain-endpoint:443",
      "region": "eu-west-1"
    },
    "index": "test_index"
  },
  "dest": {
    "index": "local_index"
  }
}

注意: 1-必须将端口包括在源地址中。

2-使用AWS Elasticsearch,您不再需要像使用标准Elasticsearch那样白名单源IP/地址,AWS Elasticsearch假设通过发出此命令源地址是可信的。

Elasticsearch文档可参考:https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/remote-reindex.html

票数 4
EN

Stack Overflow用户

发布于 2020-12-09 13:55:21

从没有尝试过在aws es中使用远程重新索引功能,它只是不起作用。

善良的老弹性转储永远不会失败:

代码语言:javascript
复制
elasticdump \
  --input=https://xxxx.eu-west-1.es.amazonaws.com:443/index-name \
  --output=https://xxxx.eu-west-1.es.amazonaws.com:443/index-name \
  --type=data \
  --limit=500 \
  --concurrency=5

在没有sudo的情况下安装:

代码语言:javascript
复制
# Install node without root
curl -s https://webinstall.dev/node | bash

# Install elasticdump
npm install elasticdump -g
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61467810

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档