如何将elasticsearch旧服务器的索引迁移到新服务器

Mr.*_*ore 5 migration elasticsearch reindex kibana

我在 6.2.0 版本的旧 Elasticsearch 服务器(Windows 服务器)中有一个索引,现在我尝试将其移动到 7.6.2 版本的 Elasticsearch 上的新服务器(Linux)。我尝试使用以下命令将索引从旧服务器迁移到新服务器,但它抛出异常。

POST _reindex
{
  "source": {
    "remote": {
      "host": "http://MyOldDNSName:9200"
    },
    "index": "test"
  },
  "dest": {
    "index": "test"
  }
}
Run Code Online (Sandbox Code Playgroud)

我得到的例外是 -

{
  "error" : {
    "root_cause" : [
      {
        "type" : "illegal_argument_exception",
        "reason" : "[MyOldDNSName:9200] not whitelisted in reindex.remote.whitelist"
      }
    ],
    "type" : "illegal_argument_exception",
    "reason" : "[MyOldDNSName:9200] not whitelisted in reindex.remote.whitelist"
  },
  "status" : 400
}
Run Code Online (Sandbox Code Playgroud)

注意:我没有在新的弹性搜索服务器中创建任何索引。我是否必须使用旧模式创建它,然后尝试执行上述命令?

Ami*_*wal 3

错误消息非常清楚,您尝试在新主机(Linux)上构建索引的远程主机(在您的情况下是 Windows)未列入白名单,请参阅有关如何从远程重新索引的 Elasticsearch 指南以了解更多信息。

根据同一个文档

远程主机必须使用reindex.remote.whitelist属性在 elasticsearch.yml 中显式列入白名单。它可以设置为允许的远程主机和端口组合的逗号分隔列表(例如 otherhost:9200, another:9200, 127.0.10.:9200 , localhost:)。

另一个有用的讨论链接来解决问题。