簡體   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