快速开始

  • 2024年1月20日
目录

如果你只需要同步已存在的数据,可以按照以下步骤完成指定索引的数据迁移。

下载 Ela 数据迁移工具

  • Windows
Invoke-WebRequest -Uri "https://github.com/CharellKing/ela/releases/download/v1.2.5/ela.exe" -OutFile "ela.exe"
  • Linux
wget https://github.com/CharellKing/ela/releases/download/v1.2.5/ela.linux.amd64 -O ela
chmod +x ela
  • MacOS
wget https://github.com/CharellKing/ela/releases/download/v1.2.5/ela.darwin.amd64 -O ela
chmod +x ela

配置文件

level: "info"
elastics:
    es5:
        addresses:
            - "http://192.168.1.55:9200"
            - "http://192.168.1.56:9200"
            - "http://192.168.1.56:9200"
        user: "es-user"
        password: "123456"
    es8:
        addresses:
            - "http://192.168.1.67:9200"
            - "http://192.168.1.68:9200"
            - "http://192.168.1.69:9200"
        user: "es-user2"
        password: "123456"
tasks:
  - name: stock-sync-task
    source_es: es5
    target_es: es8
    index_pairs:
      -
        source_index: "hello_sample"
        target_index: "sample_123"
    index_pattern: "test_.*"
    force: false
    slice_size: 5
    scroll_size: 5000
    buffer_count: 3000
    action_parallelism: 5
    action_size: 5
    scroll_time: 10
    parallelism: 12
    action: sync
  • 根据你的实际情况,需要修改 elastics 配置参数,设置源和目标 ES 集群的地址、用户名和密码。

  • 根据 elastics 配置,修改 source_es 和 target_es 为你的源和目标 ES 集群的名称。

  • 根据你的需求,修改 index_pairs 中的 source_index 和 target_index 为你的源和目标索引名称,或修改 index_pattern 正则表达式以匹配你想要迁移的索引。

执行迁移任务

  • 执行单个任务
ela.exe -c config.yaml --task stock-sync-task

–task 参数后面应该跟随在 tasks 部分定义的任务名称。

  • 执行所有任务
ela.exe -c config.yaml --tasks
分享 :