elasticsearch数据迁移——elasticsearch-dump使用


先安装好nodejs和nodejs的包管理工具npm。然后安装elasticsearch-dump:

npm install elasticdump

 

下面迁移数据:

先在目的地址创建一个index来储存数据:

curl -X PUT 'localhost:9200/customer?pretty'

执行迁移命令:--input设置导出的源地址,--output设置导出的目的地址

'#拷贝analyzer如分词
elasticdump \
  --input=http://production.es.com:9200/my_index \
  --output=http://staging.es.com:9200/my_index \
  --type=analyzer
'#拷贝映射
elasticdump \
  --input=http://production.es.com:9200/my_index \
  --output=http://staging.es.com:9200/my_index \
  --type=mapping
'#拷贝数据
elasticdump \
  --input=http://production.es.com:9200/my_index \
  --output=http://staging.es.com:9200/my_index \
  --type=data

 

这里我们指定--type=data来导出数据,成功:

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM