繁体   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