使用elasticdump迁移数据时遇MOVED_PERMANENTLY错误求助
解决elasticdump迁移时MOVED_PERMANENTLY错误的方案
错误日志:
Mon, 14 Nov 2022 14:42:21 GMT | starting dump Mon, 14 Nov 2022 14:42:22 GMT | got 10 objects from source elasticsearch (offset: 0) Mon, 14 Nov 2022 14:42:22 GMT | sent 10 objects to destination file, wrote 10 Mon, 14 Nov 2022 14:42:22 GMT | Error Emitted => This and all future requests should be directed to the given URI. Mon, 14 Nov 2022 14:42:22 GMT | Error Emitted => This and all future requests should be directed to the given URI. Mon, 14 Nov 2022 14:42:22 GMT | Total Writes: 0 Mon, 14 Nov 2022 14:42:22 GMT | dump ended with error (get phase) => MOVED_PERMANENTLY: This and all future requests should be directed to the given URI.
问题原因:
Elasticsearch返回了301永久重定向响应,而elasticdump默认不会自动跟随重定向,导致后续请求失败,迁移中断。
解决方案:
- 替换源地址为正确的重定向目标URI:确认Elasticsearch集群的实际访问地址,将elasticdump命令中
--input参数的旧地址替换为新的URI。 - 启用重定向跟随:如果使用的elasticdump版本支持,添加
--followRedirects true参数,示例命令:elasticdump --input http://old-es-address:9200/target-index --output ./data-dump.json --followRedirects true - 检查前端代理配置:若Elasticsearch前部署了反向代理(如Nginx),确认代理规则没有返回不必要的重定向,同时确保请求地址与代理配置的域名/IP完全匹配。
内容的提问来源于stack exchange,提问作者Andriy
相关产品推荐
相关产品推荐

