支持同集羣複製和跨集羣複製html
優勢:經過簡單配置便可實現、零編碼。elasticsearch
缺點:logstash 單點運行遷移,速度通常。ide
以es2.2.1 logstash2.2.1 爲例ui
如下logstash 配置功能爲遷移同一個集羣 索引 hottest_20170805_bak2 到 hottest_20170805_bak3編碼
若是是跨集羣修改ip便可spa
1 #logstash 輸入插件 2 input { 3 elasticsearch { 4 hosts => [ "192.168.126.132:9200", "192.168.126.134:9200", "192.168.126.135:9200" ] #來源集羣 5 index => "hottest_20170805_bak2" 6 size => 1000 7 scroll => "5m" 8 docinfo => true 9 scan => true 10 } 11 } 12 13 filter { 14 mutate { 15 remove_field => ["@timestamp", "@version"] #過濾掉logstash 本身加上的字段 16 } 17 } 18 19 #logstash 輸出插件 20 output { 21 elasticsearch { 22 hosts => [ "192.168.126.132:9200", "192.168.126.134:9200", "192.168.126.135:9200" ] #目標集羣 23 index => "hottest_20170805_bak3" 24 #index => "%{[@metadata][_index]}" 和來源索引相同 25 document_type => "%{[@metadata][_type]}" #和來源索引相同 26 document_id => "%{[@metadata][_id]}" 27 flush_size => 100 #批量提交數量 28 workers => 4 #並行數量 29 } 30 }
啓動logstash,-f 指向配置文件地址。插件
logstash 配置參考code
官網
input 插件參數
https://www.elastic.co/guide/en/logstash/2.2/plugins-inputs-elasticsearch.html
output 插件參數
https://www.elastic.co/guide/en/logstash/2.2/plugins-outputs-elasticsearch.htmlhtm