name: task_SAMPLE_DATABASE # global unique
task-mode: all # full/incremental/all
target-database:
host: ""
port:
user: ""
password: ""
mysql-instances: # one or more source database, config more source database for sharding merge
-
source-id: "SOURCE_ID" # unique in all instances, used as id when save checkpoints, configs, etc.
black-white-list: "instance"
filter-rules: ["user-filter-1"]
route-rules: ["user-route-rules-schema"]
mydumper-config-name: "global" # ref `mydumpers` config
loader-config-name: "global" # ref `loaders` config
syncer-config-name: "global" # ref `syncers` config
mydumpers: # mydumper process unit specific configs, mysql instance can ref one config in it
global:
mydumper-path: "./bin/mydumper"
threads: 4
chunk-filesize: 64
skip-tz-utc: true
extra-args: "-W -B 'SAMPLE_DATABASE' --no-locks"
loaders: # loader process unit specific configs, mysql instance can ref one config in it
global:
pool-size: 16
dir: "./dumped_data"
syncers: # syncer process unit specific configs, mysql instance can ref one config in it
global:
worker-count: 3
batch: 100
safe-mode: true
routes: # schema/table route mapping
user-route-rules-schema:
schema-pattern: "language" # pattern of the upstream schema name, wildcard characters (*?) are supported
target-schema: "language_s" # downstream schema name
filters: # filter rules, mysql instance can ref rules in it
user-filter-1:
schema-pattern: "*" # pattern of the upstream schema name, wildcard characters (*?) are supported
table-pattern: "*" # pattern of the upstream table name, wildcard characters (*?) are supported
events: ["truncate table", "drop table", "drop database"]
# pattern of the SQL statements, regular expression is supported
# when using global filtering rule (`schema-pattern: "*"`), it will try to match the original statement executed in the upstream
# when not using global filtering rule, it will try to match the statement parsed/restored by DM without route-rules applied (can find it in the log)
sql-pattern: ["ADD\\s+PRIMARY\\s+KEY",
"CREATE\\s+TABLE[\\s\\S]*gb2312", "CREATE\\s+PROCEDURE","CREATE\\s+DEFINER[\\s\\S]*ON SCHEDULE","CREATE[\\s\\S]*TEMPORARY[\\s\\S]*TABLE",
"ALTER\\s+TABLE[\\s\\S]*DROP INDEX","ALTER\\s+TABLE[\\s\\S]*ADD INDEX","ALTER\\s+TABLE[\\s\\S]*ADD CONSTRAINT[\\s\\S]*FOREIGN KEY","ALTER\\s+TABLE[\\s\\S]*RENAME AS","ALTER\\s+TABLE[\\s\\S]*ADD\\s+PARTITION", "ALTER\\s+TABLE[\\s\\S]*DROP\\s+PARTITION",
"SHOW\\s+COLUMNS",
"DROP\\s+EVENT","DROP\\s+FUNCTION","DROP\\s+PROCEDURE", "DROP[\\s\\S]*TEMPORARY[\\s\\S]*TABLE"
]
#"RENAME\\s+TABLE",
action: Ignore
black-white-list:
instance:
do-dbs: ["SAMPLE_DATABASE"]
#ignore-tables:
#- db-name: "~.*"
# tbl-name: ""
可以考虑配置多个task分别同步