📣 【职等你来,开心一“夏”】极限科技开放多个职位:Golang 后端研发、前端、搜索运维等 👉 : 立即申请加入
ES 数据迁移之 INFINI Gateway
Easysearch
Gateway
2025-09-21

之前有 博客介绍过通过 Reindex 的方法将 Elasticsearch 的数据迁移到 Easysearch 集群,今天再介绍一个方法,通过 INFINI Gateway 来进行数据迁移。

测试环境 #

软件版本
Easysearch1.12.0
Elasticsearch7.17.29
INFINI Gateway1.29.2

迁移步骤 #

  1. 选定要迁移的索引
  2. 在目标集群建立索引的 mapping 和 setting
  3. 准备 INFINI Gateway 迁移配置
  4. 运行 INFINI Gateway 进行数据迁移

迁移实战 #

  1. 选定要迁移的索引

在 Elasticsearch 集群中选择目标索引:infinilabs 和 test1,没错,我们一次可以迁移多个。

  1. 在 Easysearch 集群使用源索引的 setting 和 mapping 建立目标索引。(略)
  2. INFINI Gateway 迁移配置准备

去 github 下载 配置,修改下面的连接集群的部分

  1 env:
  2   LR_GATEWAY_API_HOST: 127.0.0.1:2900
  3   SRC_ELASTICSEARCH_ENDPOINT: http://127.0.0.1:9200
  4   DST_ELASTICSEARCH_ENDPOINT: http://127.0.0.1:9201
  5 path.data: data
  6 path.logs: log
  7 progress_bar.enabled: true
  8 configs.auto_reload: true
  9
 10 api:
 11   enabled: true
 12   network:
 13     binding: $[[env.LR_GATEWAY_API_HOST]]
 14
 15 elasticsearch:
 16   - name: source
 17     enabled: true
 18     endpoint: $[[env.SRC_ELASTICSEARCH_ENDPOINT]]
 19     basic_auth:
 20       username: elastic
 21       password: goodgoodstudy
 22
 23   - name: target
 24     enabled: true
 25     endpoint: $[[env.DST_ELASTICSEARCH_ENDPOINT]]
 26     basic_auth:
 27       username: admin
 28       password: 14da41c79ad2d744b90c

pipeline 部分修改要迁移的索引名称,我们迁移 infinilabs 和 test1 两个索引。

 31 pipeline:
 32   - name: source_scroll
 33     auto_start: true
 34     keep_running: false
 35     processor:
 36       - es_scroll:
 37           slice_size: 1
 38           batch_size: 5000
 39           indices: "infinilabs,test1"
 40           elasticsearch: source
 41           output_queue: source_index_dump
 42           partition_size: 1
 43           scroll_time: "5m"
  1. 迁移数据
./gateway-mac-arm64

#如果你保存的配置文件名称不叫 gateway.yml,则需要加参数 -config 文件名

数据导入完成后,网关 ctrl+c 退出。

至此,数据迁移就完成了。下一篇我们来介绍 INFINI Gateway 的数据比对功能。
有任何问题,欢迎加我微信沟通。

标签
Coco AI x
Easysearch x
Gateway x
Console x
Loadgen x
开源 x