TiDB Data Migration 导出和导入集群的数据源和任务配置

config 命令用于导出和导入集群的数据源和任务配置。

导出和导入集群的数据源和任务配置 - 图1

注意

对于 v2.0.5 版本之前的集群,可使用 >= v2.0.5 且 < v8.0.0 的 dmctl 导出和导入集群的数据源和任务配置文件。

1. » help config
2. Commands to import/export config

4. Usage:
5. dmctl config [command]

7. Available Commands:
8. export      Export the configurations of sources and tasks.
9. import      Import the configurations of sources and tasks.

11. Flags:
12. -h, --help   help for config

14. Global Flags:
15. -s, --source strings   MySQL Source ID.

17. Use "dmctl config [command] --help" for more information about a command.

导出集群的数据源和任务配置

使用 export 子命令导出集群的数据源和任务配置到指定文件夹中。

1. config export [--dir directory]

参数解释

  • dir:
  • 可选
  • 指定导出文件夹路径
  • 默认值为 ./configs

返回结果示例

1. config export -d /tmp/configs
1. export configs to directory `/tmp/configs` succeed

导入集群的数据源和任务配置

使用 import 子命令从指定文件夹中导入集群的数据源和任务配置。

1. config import [--dir directory]

导出和导入集群的数据源和任务配置 - 图2

注意

对于 v2.0.2 版本之后的集群,暂不支持自动导入 relay worker 的相关配置,可以手动使用 start-relay 命令开启 relay log。

参数解释

  • dir:
  • 可选
  • 指定导入文件夹路径
  • 默认值为 ./configs

返回结果示例

1. config import -d /tmp/configs
1. start creating sources
2. start creating tasks
3. import configs from directory `/tmp/configs` succeed