迁移工具:
elasticsearch-dump
前提:
阿里云elasticsearch开启“自动创建索引”
一、安装elasticdump
-
安装node.js。
-
下载安装包。
wget https://nodejs.org/dist/v16.18.0/node-v16.18.0-linux-x64.tar.xz
-
解压。
tar -xf node-v16.18.0-linux-x64.tar.xz
-
设置环境变量。
-
临时生效
export PATH=$PATH:/root/node-v16.18.0-linux-x64/bin/
-
永久生效
vim ~/.bash_profile export PATH=$PATH:/root/node-v16.18.0-linux-x64/bin/ source ~/.bash_profile
-
-
安装elasticsearch-dump。
npm install elasticdump -g
查看安装目录
npm root -g
ln -s /usr/local/node/lib/node_modules/elasticdump/bin/elasticdump /usr/local/bin
二、迁移指定索引
迁移指定索引的settings
elasticdump --input=http://"<UserName>:<YourPassword>"@<YourEsHost>/<YourEsIndex> --output=http://"<OtherName>:<OtherPassword>"@<OtherEsHost>/<OtherEsIndex> --type=settings
--limit 10000
迁移指定索引的mapping
elasticdump --input=http://"<UserName>:<YourPassword>"@<YourEsHost>/<YourEsIndex> --output=http://"<OtherName>:<OtherPassword>"@<OtherEsHost>/<OtherEsIndex> --type=mapping
--limit 10000
迁移指定索引的data
elasticdump --input=http://"<UserName>:<YourPassword>"@<YourEsHost>/<YourEsIndex> --output=http://"<OtherName>:<OtherPassword>"@<OtherEsHost>/<OtherEsIndex> --type=data
--limit 10000
type是ES数据导出导入类型,Elasticdum工具支持以下数据类型的导入导出——
mapping ES的索引映射结构数据
data ES的数据
settings ES的索引库默认配置
limit 从SOURCE备份到DESTINATION的对象数量,默认是100,可自定义设置
参考:
https://help.aliyun.com/zh/es/use-cases/use-elasticsearch-dump-to-migrate-data?spm=a2c4g.11186623.0.0.317b7c67NLpasX
https://www.cnblogs.com/zhujiqian/p/14641972.html
标签:
elasticsearch
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架
2019-07-19 mysql多源复制,多主一从复制