posts - 299,comments - 31,views - 62万

迁移工具:

elasticsearch-dump

 

前提:

阿里云elasticsearch开启“自动创建索引

 

一、安装elasticdump

  1. 安装node.js。

    1. 下载安装包。

       
      wget https://nodejs.org/dist/v16.18.0/node-v16.18.0-linux-x64.tar.xz
    2. 解压。

       
      tar -xf node-v16.18.0-linux-x64.tar.xz
    3. 设置环境变量。

      • 临时生效

         
        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








posted on   小油2018  阅读(16)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架
历史上的今天:
2019-07-19 mysql多源复制,多主一从复制
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示