# Creating a Replication Task

+ Create a `changefeed` to create a replication task
+ **`sink-uri:`** The downstream address of the replication task
  + The scheme supports `mysql/tidb/kafka/pulsar/s3/local`
+ **`changefeed-id:`** The `ID` of the replication task.
+ **`start-ts:`** Specifies the starting `TSO` of the `changefeed`, default value is the current time
+ **`target-ts:`** Specifies the ending `TSO` of the `changefeed`, default value is empty
+ **`sort-engine:`** Specifies the sorting engine for the `changefeed`
  + **`unified`** (default), **`memory`** (not recommended), **`file`** (deprecated)
+ For example:
```
$ tiup cdc cli ~!@changefeed create@!~ \ 
  --pd=http://10.0.0.138:2379 \
  --sink-uri="mysql://root:123456@127.0.0.1:3306/" \ 
  --changefeed-id="simple-replication-task" \
  --sort-engine="unified"
```
-------------------------------------------------------------
In `TiCDC`, a replication task is called a `changefeed`.

`--changefeed-id:` The ID of the replication task. The format must match the `^[a-zA-Z0-9]+(\-[a-zA-Z0-9]+)*$` regular expression. If this ID is not specified, `TiCDC` automatically generates a `UUID` (the version 4 format) as the `ID`.

`--sink-uri:` The downstream address of the replication task. Configure `--sink-uri` according to the following format. Currently, the scheme supports `mysql/tidb/kafka/pulsar/s3/local`: `[scheme]://[userinfo@][host]:[port][/path]?[query_parameters]`.

`--start-ts:` Specifies the starting `TSO` of the changefeed. From this `TSO`, the `TiCDC` cluster starts pulling data. The default value is the current time.

`--target-ts:` Specifies the ending `TSO` of the changefeed. To this `TSO`, the `TiCDC` cluster stops pulling data. The default value is empty, which means that `TiCDC` does not automatically stop pulling data.

`--sort-engine:` Specifies the sorting engine for the changefeed. Because `TiDB` and `TiKV` adopt distributed architectures, `TiCDC` must sort the data changes before writing them to the sink. This option supports unified (by default)/memory/file.
- `unified:` When unified is used, `TiCDC` prefers data sorting in memory. If the memory is insufficient, `TiCDC` automatically uses the disk to store the temporary data. This is the default value of `--sort-engine`.
- `memory:` Sorts data changes in memory. It is `NOT` recommended to use this sorting engine, because `OOM` is easily triggered when you replicate a large amount of data.
- `file:` Entirely uses the disk to store the temporary data. This feature is deprecated. It is NOT recommended to use it in any situation.

`--config:` Specifies the configuration file of the changefeed.

`sort-dir:` Specifies the temporary file directory used by the sorting engine. Note that this option is not supported since `TiDB v4.0.13`, `v5.0.3` and `v5.1.0`. Do not use it any more.

