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来导出数据,成功:

猜你喜欢

转载自www.cnblogs.com/zealousness/p/9356178.html