picture

文档:  dockerhup-elastucsearch-dump

Docker install

docker pull taskrabbit/elasticsearch-dump

官方例子

# 使用映射将索引从生产复制到暂存:
docker run --rm -ti taskrabbit/elasticsearch-dump \
  --input=http://production.es.com:9200/my_index \
  --output=http://staging.es.com:9200/my_index \
  --type=mapping
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=data


# 数据文件入库
docker run --rm -ti -v /data/test:/tmp taskrabbit/elasticsearch-dump \
  --input=/tmp//my_index_mapping.json \
  --output=http://production.es.com:9200/my_index\
  --type=data

需要注意:

如果是按照例子写好自己语句发现报错:

/usr/local/bin/docker-entrypoint.sh: exec: line 9: not found

这时候需要把 每行 去掉 换成一整行

# 备份索引数据到一个文件:
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=data

 

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐