经过测试对比_reindex和logstash在es数据迁移的适用场景,推荐使用_reindex。下一为对比结果:
Reindex API | Elasticsearch Reference [6.1] | Elastic
以下为:XX平台es集群数据迁移模拟测试实施步骤
计划将集群A中的test_201912索引迁移到B集群的索引 test_new_201912
xyz平台已存在index模板
curl -XPUT http://:9200/_template/test_template -H 'Content-Type: application/json' -d '{ "order": 0, "index_patterns": [ "test*" ], "settings": { "index": { "number_of_shards": "1", "number_of_replicas": "1", "routing": { "allocation": { "require": { "box_type": "hot" } } } } }, "mappings": {}, "aliases": { "test": {} } }'
curl -XPUT http:// :9200/test_new_201912
curl http:// :9200/_cat/shards/test_new_201912 # 确认shards在目标主机
test_201912
-> test_new_201912
curl -XPOST http: //:9200/_reindex?wait_for_completion= false -H 'Content-Type: application/json' -d '{ "source": { "index": "test_201912", "size": 1000 }, "dest": { "index":"test_new_201912 " } }'
记录taskId {"task":"task123456:3208554"}
curl -XPOST http:// :9200/_reindex/ task123456:3208554/_rethrottle?requests_per_second=1000
curl -XPOST http://
curl -XDELETE http://
test_201912
手动创建_reindex的迁移task后,es会自动创建一个.task的index