# Incremental data replication - Config the replication task 

+ Edit the task configuration file `dm-task`
  + `name` / `task-mode` / `ignore-checking-items` / `target-database`

```
name: "dm-task"  # The name of the task is dm-task. 
task-mode: incremental    # The task mode is set to full (only migrates full data). 
ignore-checking-items: ["auto_increment_ID"] # Ignorable checking auto_increment_ID.

target-database:  # set the host, port, user and password of the downstream database TiDB Cloud.
 host: "tidb.ntouppt2u01.clusters.tidb-cloud.com"
 port: 4000
 user: "root"
 password: "52Ync44JKlSUvtbe"

...
```
-------------------------------------------------------------
Edit the task configuration file `dm-task.yaml`, to configure the incremental replication mode and replication starting point for each data source.
(1) `task-mode`: `incremental`
Only replicates the incremental data of the upstream `Mysql` database to the downstream `TiDB Cloud` using the `binlog`. You can set the `meta` configuration item of the instance configuration to specify the starting position of incremental replication.
(2)`ignore-checking-items`: [“auto_increment_ID”]
Add the `ignore-checking-items`: [“auto_increment_ID”]  configuration in dm-task to skip the check of `auto-increment` primary key conflict.
(3)`target-database`
We need the `host`, `port`, `user` and `password` of the downstream database `TiDB Cloud`, if you don't want to use the `root` user, you must ensure that the user you are using has the necessary permissions required by `DM`, please refer to the introduction above.

For detail, see https://docs.pingcap.com/tidb/stable/task-configuration-file-full

The whole  dm-task.yaml is:
```
routes:
# Rule 1: Migrate all tables in the user database in upstream MySQL instance with port 3306 to user_north database in the downstream TiDB instance. Migrate all tables in user database in upstream MySQL instance with port 3307 to user_east database in the downstream TiDB instance.
 instance-1-user-schema-rule: # The first of the routing mapping rule.
  schema-pattern: "user"
  target-schema: "user_north"
 instance-2-user-schema-rule:
  schema-pattern: "user"
  target-schema: “user_east"
# Rule 2: Migrate all tables in store database in upstream MySQL instance to store database in the downstream TiDB instance, except the table store.store_sz in upstream MySQL instances with port 3307 to the table store.store_suzhou in the downstream TiDB instance.
 instance-2-store-schema-rule:
  schema-pattern: "store"
  table-pattern: "store_sz"
  target-schema: "store"
  target-table: "store_suzhou"

# Rule 3: Migrate the table salesdb.sales which is sharded schemas in upstream MySQL instances with port 3306 and 3307 in the two upstream MySQL instances to the salesdb.sales tables in the downstream TiDB instance.
 salesdb-schema-route-rule:
  schema-pattern: "salesdb"
  target-schema: "salesdb"

# Rule 4: Any delete DML event on user.*, any drop table, truncate table DDL event on table user.trace and any delete, truncate table, drop table DDL event on store database in any upstream MySQL instance will not be replicated to the downstream TiDB instance.
filters:
 trace-table-filter-rule:
  schema-pattern: "user"
  table-pattern: "trace"
  events: ["truncate table", "DROP TABLE", "delete"]
  action: Ignore
 user-table-filter-rule:
  schema-pattern: "user"
  events: ["drop database"]
  action: Ignore
 store-table-filter-rule:
  schema-pattern: "store"
  events: ["drop database", "truncate table", "DROP TABLE", "delete"]
  action: Ignore

# Rule 5: The log databases in any upstream MySQL instance will not be replicated to the downstream TiDB instance.
block-allow-list:
 log-ignored:
  ignore-dbs: ["log"]
mydumpers:
 global:
  threads: 4
```