创建数据迁移任务

本文详细介绍了DM(Distributed MySQL)中`start-task`命令的使用方法和参数解析。该命令用于启动数据迁移任务,包括对源数据库的指定、任务配置文件、移除元数据选项以及设置起始时间等功能。在启动任务时,DM会进行权限和配置检查,并根据提供的参数确定数据迁移的起点。示例展示了如何使用命令启动任务并返回结果。
摘要由CSDN通过智能技术生成

start-task 命令用于创建数据迁移任务。当数据迁移任务启动时,DM 将自动对相应权限和配置进行前置检查

help start-task

Starts a task as defined in the configuration file Usage: dmctl start-task [-s source ...] [--remove-meta] <config-file> [flags] Flags: -h, --help help for start-task --remove-meta whether to remove task's meta data --start-time string specify the start time of binlog replication, e.g. '2021-10-21 00:01:00' or 2021-10-21T00:01:00 Global Flags: --config string Path to config file. --master-addr string Master API server address, this parameter is required when interacting with the dm-master --rpc-timeout string RPC timeout, default is 10m. (default "10m") -s, --source strings MySQL Source ID. --ssl-ca string Path of file that contains list of trusted SSL CAs for connection. --ssl-cert string Path of file that contains X509 certificate in PEM format for connection. --ssl-key string Path of file that contains X509 key in PEM format for connection. -V, --version Prints version and exit.

命令用法示例

start-task [ -s "mysql-replica-01"] ./task.yaml

参数解释

  • -s
    • 可选
    • 指定在特定的一个 MySQL 源上执行 task.yaml
    • 如果设置,则只启动指定任务在该 MySQL 源上的子任务
  • config-file
    • 必选
    • 指定 task.yaml 的文件路径
  • remove-meta:
    • 可选
    • 如果设置,则在启动指定任务时会移除该任务之前存在的 metadata
  • start-time:
    • 可选,格式为 '2021-10-21 00:01:00' 或 2021-10-21T00:01:00
    • 对于增量任务,可以通过该参数大致指定任务起始位点,该参数比任务配置文件中的 binlog 位置优先级更高,也比下游 checkpoint 中的 binlog 位置优先级更高
    • 当该任务存在 checkpoint 时,如果通过这种方式启动任务,DM 会自动开启 safe mode 直到同步过 checkpoint,以避免重置任务到更早位置时遇到数据重复的报错。向前重置起始位点时,如果起始位点的表结构与下游当前表结构不一致可能会在同步时报错;向后重置起始位点时,需要注意跳过的 binlog 可能在下游残留脏数据
    • 指定了过早的时间时,会从最早的 binlog 开始同步
    • 指定了过晚的时间时,会报错 start-time {input-time} is too late, no binlog location matches it

返回结果示例

start-task task.yaml

{ "result": true, "msg": "", "sources": [ { "result": true, "msg": "", "source": "mysql-replica-01", "worker": "worker1" } ] }

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

每天读点书学堂

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值