簡體   English   中英

如何有效地將數據從Elasticsearch索引(具有一個分片)移動到另一索引(具有5個分片)?

[英]How to efficiently move data from elasticsearch index (with one shard) to another index (with 5 shards)?

我有一個Elasticsearch索引,它在單個分片的單個節點上包含大約5 GB的數據。 現在,我創建了另一個索引,該索引的設置與舊索引相同,但是number_of_shards為5而不是1。

我正在尋找最有效的方法來將數據從舊索引復制到新索引,而不會造成任何停機。

我建議為此使用Logstash 您可以使用以下配置。 確保替換源主機和目標主機,以及索引和類型名稱以匹配您的本地環境。

文件:reindex.conf

input {
  elasticsearch {
   hosts => "localhost:9200"       <---- your source host
   index => "my_source_index"
  }
}
filter {
 mutate {
  remove_field => [ "@version", "@timestamp" ]
 }
}
output {
 elasticsearch {
   host => "localhost"       <--- your target host
   port => 9200
   protocol => "http"
   manage_template => false
   index => "my_target_index"
   document_type => "my_type"
   workers => 5
 }
}

然后您可以使用

bin/logstash -f reindex.conf

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM