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

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐