【老王公众号】

Elasticsearch必备技能之索引迁移

将ES中的索引拷贝到其他ES中,是不是很重要呢?

长话短说,推荐一个工具:

一、elasticsearch-dump

安装:

#yum install epel-release

#yum install nodejs

#yum install npm

#npm install elasticdump

#cd node_modules/elasticdump/bin 

# pwd

/home/tp/node_modules/elasticdump

# ls -al

total 388

drwxr-xr-x 2 root root 4096 Mar 21 15:46 bin

-rw-r--r-- 1 root root 174 Mar 18 2016 Dockerfile

-rw-r--r-- 1 root root 299251 Mar 15 2014 elasticdump.jpg

-rw-r--r-- 1 root root 6172 Feb 2 23:47 elasticdump.js

drwxr-xr-x 2 root root 4096 Jul 13 2016 .github

drwxr-xr-x 3 root root 4096 Mar 21 15:46 lib

-rw-r--r-- 1 root root 11356 May 22 2014 LICENSE.txt

drwxr-xr-x 10 root root 4096 Mar 21 15:46 node_modules

-rw-r--r-- 1 root root 44 May 22 2014 .npmignore

-rw-r--r-- 1 root root 15135 Mar 21 15:46 package.json

-rw-r--r-- 1 root root 13335 Dec 14 06:20 README.md

drwxr-xr-x 3 root root 4096 Mar 21 15:46 test

-rw-r--r-- 1 root root 1150 Dec 2 07:54 .travis.yml

 

使用:

#拷贝analyzer如分词

elasticdump \

  --input=http://production.es.com:9200/old_index \

  --output=http://staging.es.com:9200/new_index \

  --type=analyzer

#拷贝映射

elasticdump \

  --input=http://production.es.com:9200/old_index \

  --output=http://staging.es.com:9200/new_index \

  --type=mapping

#拷贝数据

elasticdump \

  --input=http://production.es.com:9200/lod_index \

  --output=http://staging.es.com:9200/new_index \

  --type=data

 

OK ! 迁移成功。

 

 

推荐阅读:

微信支付开发中几个值得注意的地方

解析:微服务的原则

老王讲架构:负载均衡

支付宝系统架构内部剖析

SaaS技术栈的走势

大数据Spark与Storm技术选型

 

posted @ 2018-10-19 10:17  CTO老王  阅读(1633)  评论(0编辑  收藏  举报