Easysearch 数据迁移之 INFINI Gateway
之前有博客介绍过通过 Reindex 的方法将 Elasticsearch 的数据迁移到 Easysearch 集群,今天再介绍一个方法,通过 INFINI Gateway 来进行数据迁移。
测试环境
软件
版本
Easysearch
1.12.0
Elasticsearch
7.17.29
INFINI Gateway
1.29.2
迁移步骤
- 选定要迁移的索引
- 在目标集群建立索引的 mapping 和 setting
- 准备 INFINI Gateway 迁移配置
- 运行 INFINI Gateway 进行数据迁移
迁移实战
1. 选定要迁移的索引
在 Elasticsearch 集群中选择目标索引:infinilabs 和 test1,没错,我们一次可以迁移多个。
2. 在 Easysearch 集群使用源索引的 setting 和 mapping 建立目标索引。
3. 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\"
4. 迁移数据
./gateway-mac-arm64#如果你保存的配置文件名称不叫 gateway.yml,则需要加参数 -config 文件名
去 INFINI Console 查看数据导入完成后,网关 ctrl+c 退出。
至此,数据迁移就完成了。下一篇我们来介绍 INFINI Gateway 的数据比对功能。