2015-05-25 28 views
1

我在我的http://localhost:9200中有3个索引,它们是index1,index2index3如何将我的本地索引数据复制到另一个ip的elasticsearch

我需要将所有这些索引复制到http://some_ip:9200。如何将我的所有索引数据复制到另一个IP的elasticsearch中。

+0

我想你可以复制 HTTPS://www.elastic。 co/guide/en/elasticsearch/guide/current/replica-shards.html –

+0

这是一次性操作还是您想要不断执行此操作? –

+0

只是一次行动 –

回答

1

您可以使用logstash(see how to install)和elasticsearchinputoutput插件。你logstash.conf文件应该是这样的:

input { 
    elasticsearch { 
    hosts => ["localhost:9200"] 
    index => "index1" 
    } 
} 
filter { 
} 
output { 
elasticsearch { 
    host => "some_ip" 
    port => 9200 
    protocol => "http" 
    index => "index1" 
    manage_template => false 
    workers => 5 
} 
} 

可以再用$ bin/logstash -f logstash.conf

冲洗运行此再次为index2index3

+0

我们可以使用elasticsearch dsl吗? –

+0

logstash在做什么是[扫描](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html)源ES主机从您的索引中提取文档(index1,index2和index3),然后使用['_bulk'](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html)发送这些检索到的文档。我建议的logstash解决方案可以防止您重新发明轮子来移动数据。 – Val

+0

实际上,我需要在活动群集中执行此操作。我不想在那里安装logstash。我想编写简单的python脚本,以便完成这些更改。 –

相关问题