繁体   English   中英

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

[英]How to migrate index from Old Server to new server of elasticsearch

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

POST _reindex
{
  "source": {
    "remote": {
      "host": "http://MyOldDNSName:9200"
    },
    "index": "test"
  },
  "dest": {
    "index": "test"
  }
}

我得到的例外是 -

{
  "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
}

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

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

根据同一个文档

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

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

https://www.elastic.co/guide/en/elasticsearch/reference/8.0/docs-reindex.html#reindex-from-remote

将此添加到 elasticsearch.yml 中,根据您的环境进行修改:

reindex.remote.whitelist: "otherhost:9200, another:9200, 127.0.10.*:9200, localhost:*"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM