1、Docker拉取镜像
docker pull taskrabbit/elasticsearch-dump
2、
docker run --rm -ti taskrabbit/elasticsearch-dump
-v <your dumps dir>:<your mount point>
到docker容器中官方例子:
#使用映射将索引从生产复制到暂存:
docker run --rm -ti taskrabbit / elasticsearch-dump \
--input = http://production.es.com:9200 / my_index \
--output = http://staging.es.com:9200 / my_index \
--type = analyzer
docker run --rm -ti taskrabbit / elasticsearch-dump \
--input = http://production.es.com:9200 / my_index \
--output = http://staging.es.com:9200 / my_index \
--type = data
#将索引数据备份到文件:
docker run --rm -ti -v / data:/ tmp taskrabbit / elasticsearch-dump \
--input = http://production.es.com:9200 / my_index \
--output = / tmp / my_index_mapping.json \
--type = mapping
下面是用到的个具体例子:
#数据导出成文件
docker run --rm -ti -v /data/test:/tmp taskrabbit/elasticsearch-dump \
--input=http://192.168.1.14:20269/yuqing_2019_1 \
--output=/tmp/yuqing_2019_1.json \
--type=data
其中,/data/test 是本地的导出目录
#数据文件入库
docker run --rm -ti -v /data/test:/tmp taskrabbit/elasticsearch-dump \
--input=/tmp/yuqing_2019_1.json \
--output=http://192.168.1.14:20269/yuqing_2019_1\
--type=data
其中,/data/test 是本地的导入目录
参考:https://github.com/taskrabbit/elasticsearch-dump?utm_source=dbweekly&utm_medium=email