标签:下载 bash 主机 数据 迁移 oca last hub host
elasticdump 迁移 elasticsearch 数据elasticdump github地址
https://github.com/taskrabbit/elasticsearch-dump
折腾了一会nodejs耐心尽失,果断使用docker方式。
拉取镜像
docker pull taskrabbit/elasticsearch-dump
如果将数据导出为文件形式,需要将宿主机目录挂载至容器上。
# 提前创建数据目录。
mkdir /data
导出数据至json文件中,将宿主机/data目录挂载到容器/tmp目录上,--output指定文件导出至/tmp目录中。
docker run --net=host --rm -ti -v /data:/tmp taskrabbit/elasticsearch-dump --input=http://localhost:9200/info-ad --output=/tmp/info-ad-map.json --type=data
# 导出日志
Wed, 11 Dec 2019 09:45:35 GMT | starting dump
Wed, 11 Dec 2019 09:45:35 GMT | got 16 objects from source elasticsearch (offset: 0)
Wed, 11 Dec 2019 09:45:35 GMT | sent 16 objects to destination file, wrote 16
Wed, 11 Dec 2019 09:45:35 GMT | got 0 objects from source elasticsearch (offset: 16)
Wed, 11 Dec 2019 09:45:35 GMT | Total Writes: 16
Wed, 11 Dec 2019 09:45:35 GMT | dump complete
# 导出文件
[root@localhost /data]# ll
total 20
-rw-r--r--. 1 root root 18192 Dec 11 17:45 info-ad-map.json
docker run --net=host --rm -ti -v /data:/tmp taskrabbit/elasticsearch-dump --input=/tmp/info-ad-map.json --output=http://localhost:9200/abcd
# 导入日志
Wed, 11 Dec 2019 09:47:43 GMT | starting dump
Wed, 11 Dec 2019 09:47:43 GMT | got 16 objects from source file (offset: 0)
Wed, 11 Dec 2019 09:47:44 GMT | sent 16 objects to destination elasticsearch, wrote 16
Wed, 11 Dec 2019 09:47:44 GMT | got 0 objects from source file (offset: 16)
Wed, 11 Dec 2019 09:47:44 GMT | Total Writes: 16
Wed, 11 Dec 2019 09:47:44 GMT | dump complete
ps:在使用localhost:9200时需要使用--net=host将网络挂载到容器上
elasticdump 迁移 elasticsearch 数据
标签:下载 bash 主机 数据 迁移 oca last hub host
原文地址:https://blog.51cto.com/13231454/2457815