dm分表合表+单表迁移同步

为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。

  • dm2.0rc版本,任务得yam文件内容如:
    name: mergetable917 # 任务名称,需要全局唯一
    is-sharding: true
    task-mode: all # 任务模式,可设为 “full”、“incremental”、“all”
    shard-mode: “pessimistic” # 如果为分库分表"
    meta-schema: “dm_meta” # 下游储存 meta 信息的数据库
    timezone: “Asia/Shanghai” # 时区
    case-sensitive: false # schema/table 是否大小写敏感
    online-ddl-scheme: “pt” # 目前仅支持 “gh-ost” 、“pt”
    clean-dump-file: true
    target-database:
    host: “xx.xx.6.12”
    port: 4000
    user: “mysql2tidb”
    password: “*****234”
    routes:
    user-route-tab1-schema:
    schema-pattern: “testdb1”
    target-schema: “testdb1”
    user-tab11-rules:
    schema-pattern: “testdb1”
    table-pattern: “~^tab1_adjustment_header_view[1-9][0-5]?”
    target-schema: “testdb1”
    target-table: “tab1_adjustment_header_view”
    user-tab12-rules:
    schema-pattern: “testdb1”
    table-pattern: “~^tab1_adjustment_header[1-9][0-5]?”
    target-schema: “testdb1”
    target-table: “tab1_adjustment_header”
    user-tab13-rules:
    schema-pattern: “testdb1”
    table-pattern: “tab1_batch_create_log”
    target-schema: “testdb1”
    target-table: “tab1_batch_create_log”
    user-tab14-rules:
    schema-pattern: “testdb1”
    table-pattern: “tab1_last_in_stock”
    target-schema: “testdb1”
    target-table: “tab1_last_in_stock”
    user-route-tab2-schema:
    schema-pattern: “testdb2”
    target-schema: “testdb2”
    user-tab2-rules:
    schema-pattern: “testdb2”
    table-pattern: “tab2_wave”
    target-schema: “testdb2”
    target-table: “tab2_wave”
    block-allow-list:
    bw-rule-1:
    do-dbs: [ “testdb1”,“testdb2” ]
    do-tables:
    • db-name: “testdb1”
      tbl-name: “~^tab1_adjustment_(header|header_view)[1-9][0-5]?” , “tab1_batch_create_log”, “tab1_last_in_stock”
    • db-name: “testdb2”
      tbl-name: “tab2_wave”

mydumpers: # mydumper process unit specific configs, mysql instance can ref one config in it
global:
threads: 2
chunk-filesize: 64
skip-tz-utc: true
loaders: # loader process unit specific configs, mysql instance can ref one config in it
global:
pool-size: 2
dir: “./dumped_data”

syncers: # syncer process unit specific configs, mysql instance can ref one config in it
global:
worker-count: 2
batch: 100
mysql-instances: # one or more source database, config more source database for sharding merge

source-id: "mysql-28" # unique in all instances, used as id when save checkpoints, configs, etc.
route-rules: ["user-route-tab1-schema","user-tab11-rules","user-tab12-rules","user-tab13-rules","user-tab14-rules","user-route-tab2-schema","user-tab2-rules"]
block-allow-list: "bw-rule-1" 
mydumper-config-name: "global"         
loader-config-name: "global"            
syncer-config-name: "global"      
  • 【问题描述】:按照上面得配置,启动任务报错,报语法错误,1,一个表中有分表、也有部分不是分表得表怎么配置路由同步规则、以及黑白名单过滤。2、此任务是分库分表合表同步到tidb中,但是到tidb中还是tidb中。这个配置有什么问题
    若提问为性能优化、故障排查类问题,请下载脚本运行。终端输出的打印结果,请务必全选并复制粘贴上传。

麻烦使用 dmctl 的 check-task 命令检查一下配置文件的正确性,可以描述一下对应的场景需求,我们再帮你 review 一下配置文件内容。
https://docs.pingcap.com/zh/tidb-data-migration/v2.0/dmctl-introduction

check-task输出信息:{
“result”: true,
“msg”: “check pass!!!”
}
场景:一个mysql实例下面有testdb1,testdb2两个库
将testdb1中得分表tab1_adjustment_header_view(1-15) 和tab1_adjustment_header(1-15)合并同步到tidb中得testdb1中得tab1_adjustment_header_view和tab1_adjustment_header表中。将testdb1库中得单表(非分表)tab1_batch_create_log同步到tidb中testdb1库下得tab1_batch_create_log中。将同一实例下testdb2库中得tab2_wave表同步到tidb中testdb2得tab2表中。
烦请帮忙看看上面配置是否合理,或者此场景应该怎么配置比较合理

根据你的反馈,这个场景合适配置 4 个 task 任务,方便管理和运维

1、 tab1_adjustment_header_view(1-15) 到 tab1_adjustment_header_view 一个任务
2、tab1_adjustment_header(1-15) 到tab1_adjustment_header
3、tab1_batch_create_log 到 tab1_batch_create_log
4、tab2_wave tab2

如果一个库中有多个表得分表,这样是不是,每个表一个task

如果表数据很大,按照最佳实践方法,最好一张表一个任务来运维,否则后期运维会很麻烦。

每个worker最多能运行多少个task 有限制吗

任务数应该是和服务器资源有关,像我们的系统,一个dm-worker有16个任务在跑。

你们一个dm集群多少个dm-worker

dm-worker有8、9个吧,但是都是分不同的服务器的(个别服务器部署了2个worker),和你现在的问题应该关系不大吧

我们现在有多个库都是分库分表,然后每个分表都单独一个task得话,我在想一个dm集群够不够

没关系的,多个 task 任务可以通过 work count 和 batch size 来控制同步和消费。如果是比较小的同步任务,可以设置低一点。

感谢两位大佬解惑

感谢提问,如果有在使用过程中遇到其他的问题,麻烦提交新的 帖子。

此话题已在最后回复的 1 分钟后被自动关闭。不再允许新回复。