记elasticdump 备份数据导出导入

本文详细记录了使用elasticdump工具在不同环境下迁移Elasticsearch数据的过程,包括从生产环境导出索引到测试环境的具体步骤,以及解决迁移中遇到的字段不支持问题的解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

版本:

elasticsearch 5.5.2

elasticdump 2.2

系统 CentOS7.3

因项目需求 从生产导出一份索引到测试

帮助文档 https://github.com/taskrabbit/elasticsearch-dump?utm_source=dbweekly&utm_medium=email

安装 yum install elasticdump

elasticdump --input=http://localhost:9200 --output=abc.json --type=data Sun, 25 Sep 2016 13:07:15 GMT | starting dump Sun, 25 Sep 2016 13:07:15 GMT | Error Emitted => {"error":{"root_cause":[{"type":"parsing_exception","reason":"The field [fields] is no longer supported, please use [stored_fields] to retrieve stored fields or _source filtering if the field is not stored","line":1,"col":36}],"type":"parsing_exception","reason":"The field [fields] is no longer supported, please use [stored_fields] to retrieve stored fields or _source filtering if the field is not stored","line":1,"col":36},"status":400} Sun, 25 Sep 2016 13:07:15 GMT | Total Writes: 0 Sun, 25 Sep 2016 13:07:15 GMT | dump ended with error (get phase) => Error: {"error":{"root_cause":[{"type":"parsing_exception","reason":"The field [fields] is no longer supported, please use [stored_fields] to retrieve stored fields or _source filtering if the field is not stored","line":1,"col":36}],"type":"parsing_exception","reason":"The field [fields] is no longer supported, please use [stored_fields] to retrieve stored fields or _source filtering if the field is not stored","line":1,"col":36},"status":400}

As a workaround, the following works:

elasticdump --input=http://9.11.8.51:9200/apm --output=apm.json --type=data --searchBody '{"query": { "match_all": {} }, "stored_fields": ["*"], "_source": true }'

elasticdump --input=apm.json --output=http://9.1.8.234:9200/apm --type=data --searchBody '{"query": { "match_all": {} }, "stored_fields": ["*"], "_source": true }'

elasticdump --input=http://9.11.8.52:9200/metric --output=/data/metric.json --type=data --limit=1000 --searchBody '{"query":{"term":{"timestamp": "2018-09-28"}}}' https://github.com/taskrabbit/elasticsearch-dump

转载于:https://my.oschina.net/kcw/blog/1856964

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值