【问题标题】:To copy an index from one machine to another in elasticsearch在elasticsearch中将索引从一台机器复制到另一台机器
【发布时间】:2015-11-04 18:32:39
【问题描述】:

我的一台机器上有一些索引。我需要将它们复制到另一台机器上,我该如何在弹性搜索中做到这一点。 我确实得到了一些很好的文档here,但由于我是 elasticsearch 生态系统的新手,而且由于我玩弄较少的数据索引,所以我想我会使用一些插件或方法来减少耗时。

【问题讨论】:

    标签: elasticsearch elasticsearch-plugin


    【解决方案1】:

    我会将Logstashelasticsearch input 插件和elasticsearch output 插件一起使用。

    installing Logstash之后,您可以创建一个配置文件copy.conf,如下所示:

    input {
      elasticsearch {
       hosts => "localhost:9200"                     <--- source ES host
       index => "source_index"
      }
    }
    filter {
     mutate {
      remove_field => [ "@version", "@timestamp" ]   <--- remove added junk
     }
    }
    output {
     elasticsearch {
       host => "localhost"                           <--- target ES host
       port => 9200
       protocol => "http"
       manage_template => false
       index => "target_index"
       document_id => "%{id}"                        <--- name of your ID field
       workers => 1
     }
    }
    

    然后在设置正确的值(源/目标主机 + 源/目标索引)之后,您可以使用 bin/logstash -f copy.conf 运行它

    【讨论】:

    • @michaellother 运气好吗?
    • 是的。但我一直在寻找不涉及logstash的更简单的东西。
    • 那么我会推荐另一个利用快照/恢复的答案。
    【解决方案2】:

    我可以在这里看到 3 个选项

    1. 快照/恢复 - 您可以跨地理位置移动数据。
    2. Lo​​gstash 重新索引 - 正如 Val 指出的那样
    3. Stream2ES - 这是一个更简单的解决方案

    【讨论】:

      【解决方案3】:

      您也可以使用快照和恢复功能,您可以在其中拍摄一个索引的快照(备份),然后可以恢复到其他地方。

      看看 https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2018-08-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-08-13
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多