DM备份启动报错

TiDB 5.4.0
DM备份启动的时候报错如下:
“msg”: “[code=20003:class=dm-master:scope=internal:level=medium], Message: decode task config failed, RawCause: yaml: unmarshal errors:\ line 37: field import-mode not found in type config.rawLoaderConfig\ line 38: field on-duplicate not found in type config.rawLoaderConfig, Workaround: Please check the configuration file has correct YAML format.”
配置文件中就多了如下配置:
loaders:
global:
import-mode: “sql”
on-duplicate: “ignore”

整个yaml配置文件如下:
name: “ailearn_statistic-kaifa”
task-mode: “all”
shard-mode: “pessimistic”
meta-schema: “dm_meta” # 将在下游数据库创建 schema 用于存放元数据
ignore-checking-items: [“auto_increment_ID”] # 本示例中上游存在自增主键,因此需要忽略掉

target-database:
host: “10.60.0.9”
port: 4000
user: “dm_worker”
password: “FslwxcUfxXBLFd1NV8yr5EBupFdiZEl2BTkx0g==”

mysql-instances:

  • source-id: “mysql-ailearn-kaifa” # 数据源 ID,即 source1.yaml 中的 source-id
    route-rules: [“sale-route-rule”] # 应用于该数据源的 table route 规则
    block-allow-list: “log-bak-ignored” # 应用于该数据源的 Block & Al
    loader-config-name: “global” # loaders 配置的名称

分表合并配置

routes:
sale-route-rule:
schema-pattern: “ailearn_statistic”
table-pattern: “okminicourse_learn_record_*”
target-schema: “ailearn_statistic”
target-table: “okminicourse_learn_record”

黑白名单

block-allow-list:
log-bak-ignored:
do-tables:
- db-name: “ailearn_statistic”
tbl-name: “okminicourse_learn_record_*”

loaders:
global:
import-mode: “sql”
on-duplicate: “ignore”

import-mode: “sql” 可以去掉。默认就是这个

取掉这个 import-mode: “sql” 试试, 没有特殊需求的 就按照默认配置就可以

您没有填 DM 的版本信息。如果和您的 TiDB 版本一致的话,应该是 5.4。

5.4 版本的 loaders 配置项不支持 import-mode 选项。

FYI: https://docs.pingcap.com/zh/tidb/v5.4/task-configuration-file-full