简体   繁体   中英

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. 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.

As per same doc

Remote hosts have to be explicitly whitelisted in elasticsearch.yml using the reindex.remote.whitelist property. 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: ).

Another useful discuss link to troubleshoot the issue.

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:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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