简体   繁体   English

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

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

I have one index in old elasticsearch server in 6.2.0 version (windows server) and now I am trying to move it to new server (Linux) on 7.6.2 version of elasticsearch.我在 6.2.0 版本(Windows 服务器)的旧 elasticsearch 服务器中有一个索引,现在我正试图将它移动到 elasticsearch 的 7.6.2 版本的新服务器(Linux)。 I tried below command to migrate my index from old to new server but it is throwing an exception.我尝试使用以下命令将我的索引从旧服务器迁移到新服务器,但它引发了异常。

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

Exception I am getting is -我得到的例外是 -

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

Note: I did not created any index in new elastic search server.注意:我没有在新的弹性搜索服务器中创建任何索引。 do I have to create it with my old schema and then try to execute the above command?我是否必须使用旧模式创建它,然后尝试执行上述命令?

The error message is quite clear that your remote host(windows in your case) from which you are trying to build in a index on your new host(Linux) is not whitelisted, Please refer Elasticsearch guide on how to reindex from remote on more info.错误消息很清楚,您尝试在新主机(Linux)上构建索引的远程主机(在您的情况下为 Windows)未列入白名单,请参阅Elasticsearch 指南,了解如何从远程重新索引更多信息.

As per same doc根据同一个文档

Remote hosts have to be explicitly whitelisted in elasticsearch.yml using the reindex.remote.whitelist property.远程主机必须使用reindex.remote.whitelist属性在 elasticsearch.yml 中明确列入白名单。 It can be set to a comma delimited list of allowed remote host and port combinations (eg otherhost:9200, another:9200, 127.0.10. :9200, localhost: ).它可以设置为允许的远程主机和端口组合的逗号分隔列表(例如 otherhost:9200, another:9200, 127.0.10.:9200 , localhost: )。

Another useful discuss link to troubleshoot the issue.另一个有用的讨论链接来解决问题。

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

Add this to elasticsearch.yml, modify it according your environment:将此添加到 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