设置参数 `node.name` 可以自定义 Elasticsearch 节点的名字。 此条 Tips 由 medcl 贡献。

如何把一个Elasticsearch上的数据全部迁移到另一个Elasticsearch服务器上?

Elasticsearch | 作者 sailershen | 发布于2019年12月26日 | 阅读数:5640

现在所有服务器上的数据都通过logstash传输到一个Elasticsearch服务器上,如何把这些数据迁移到另一个Elasticsearch服务器上?两个Elasticsearch不是集群关系,完全独立。
已邀请:

- Elasticsearch,php

赞同来自: sailershen

官方文档 reindex api
1、给目标集群新增白名单配置
reindex.remote.whitelist: "otherhost:9200, another:9200, 127.0.10.*:9200, localhost:*"
2、使用reindex api 将源集群索引迁移到目标集群
curl -X POST "localhost:9200/_reindex?pretty" -H 'Content-Type: application/json' -d'
{
"source": {
"remote": {
"host": "http://otherhost:9200",
"username": "user",
"password": "pass"
},
"index": "source",
"query": {
"match": {
"test": "data"
}
}
},
"dest": {
"index": "dest"
}
}
'

trycatchfinal

赞同来自:

数据量不大的话,用logstash也很方便

stephen_qu - 多学,多动手,少说废话

赞同来自:

公司现在做ES升级,由原先的2.X升级到6.X版本。用reindex,将数据迁移到其他的节点上,150W左右的数据,大概要多长时间?如果中间出现网络中断等问题,会不会回滚之类的措施?另外有什么较好的方案保证迁移的过程数据不丢失

要回复问题请先登录注册