犯二青年博客
  • 首页
  • 后端技术
  • 前端技术
  • 其他文章
  • 留言板
  • 友链
  • 关于

ElasticSearch Dump做数据迁移

犯二青年 发布于 2023-05-19

  • 📒 后端技术
  • 📒 ElasticSearch Dump
  • 📒 ElasticSearch
  • 🏷️ 后端技术
  • 🏷️ ElasticSearch
  • 🏷️ ElasticSearch Dump
  • 🏷️ 数据迁移

导出数据为json文件

1
2
3
4
5
6
7
8
docker run --rm --net=host -ti -v /data:/tmp elasticdump/elasticsearch-dump \
--input=http://username:password@源ElasticSearch实例地址:9200 \
--output=/tmp/dump_file.json \
--input-index=要导出的索引名称 \
--output-index=导出后的索引名称 \
--searchBody='{"query": {"match": {"org_code": "xxxx"}}}' \
--limit=10000 \
--type=data

直接将源数据导入到目标实例内

1
2
3
4
5
6
7
8
docker run --rm --net=host -ti -v /data:/tmp elasticdump/elasticsearch-dump \
--input=http://username:password@源ElasticSearch实例地址:9200 \
--output=http://username:password@目标ElasticSearch实例地址:9200 \
--input-index=要导出的索引名称 \
--output-index=导出后的索引名称 \
--searchBody='{"query": {"match": {"org_code": "xxxx"}}}' \
--limit=10000 \
--type=data

参数解释:

  • --input ES实例的地址,实例地址后面不应该有uri,应该为一个完整域名作为实例地址
  • --output 文件导出后输出路径,也可以是一个ES地址
  • --input-index 需要导出的索引名称
  • --output-index 导出文件中命名的索引名称,如导出前的索引名称为xsdj_aliyun_asr_test,你想导出后的文件里索引名称为xsdj_aliyun_asr_prod,那么此处应该填写为xsdj_aliyun_asr_prod
  • --searchBody 需要导出的数据条件过滤
  • --limit 导出批次数量大小,类似于分页的大小
  • --type 如果从 Elasticsearch 7.x 版本导出数据并将其导入到 Elasticsearch 6.x 版本中,则需要使用 --type=data 参数来指定数据类型为 “data”。如果使用 Elasticsearch 6.x 版本,则不需要使用该参数

mysqldump做数据备份

上一篇

记一次签到积分薅羊毛过程和思路

下一篇
犯二青年

犯二青年

一个平淡的开发者~

38
16
51
TOC
  1. 1. 导出数据为json文件
  2. 2. 直接将源数据导入到目标实例内
  3. 3. 参数解释:
NOTICE

保持好奇,刻意练习,每日精进!

CATEGORYS
  • 后端技术 (36)
  • ElasticSearch Dump (1)
  • 踩坑日记 (1)
  • ElasticSearch (1)
  • 其他文章 (2)
  • EFK (3)
  • 开发小技巧 (1)
  • ElasticSearch (3)
  • 微服务 (1)
  • 对称加密 (1)
  • 薅羊毛 (1)
  • gRPC (1)
  • Chrome (1)
  • Ubuntu (1)
  • ChromeDP (1)
  • ChromeDriver (1)
TAGS
API签名 Charles Chrome ChromeDP ChromeDriver Docker Docker Desktop ElasticSearch ElasticSearch Dump Elasticsearch Filebeat Git Github Actions Golang Hyperf Jenkins Kibana Laravel Linux MySQL PHP PhpStorm Swoole Ubuntu Windows Xdebug deploy gRPC git github hyperf k8s k8s教程系列 mysqldump oh-my-zsh php-cs-fixer sql supervisord web逆向 zsh 后端技术 并发编程 开发小技巧 微服务 数据库备份 数据库迁移 数据迁移 生活小技巧 编程感悟 薅羊毛 运维技巧

© 2025 犯二青年

琼ICP备2024048013号-1

Powered by 犯二青年 托管于 GitHub & 七牛云

本站总访问量次 | 本站访客数人

🌞 浅色 🌛 深色 🤖️ 自动