Skip to content

Commit

Permalink
ticdc: update pd parameters in cdc cli command (pingcap#5318)
Browse files Browse the repository at this point in the history
* ticdc: update pd parameters in cdc cli command

* update content

* typo

* Update ticdc/troubleshoot-ticdc.md

Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com>

* Update ticdc/manage-ticdc.md

Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com>

Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com>
  • Loading branch information
amyangfei and TomShawn authored Jan 18, 2021
1 parent 1e090d9 commit 6134056
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
10 changes: 7 additions & 3 deletions ticdc/manage-ticdc.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ tiup cluster upgrade <cluster-name> v4.0.6

本部分介绍如何使用 `cdc cli` 工具来管理集群状态和数据同步。`cdc cli` 是指通过 `cdc` binary 执行 `cli` 子命令。在以下接口描述中,通过 `cdc` binary 直接执行 `cli` 命令,PD 的监听 IP 地址为 `10.0.10.25`,端口为 `2379`

> **注意:**
>
> PD 监听的 IP 和端口对应为 `pd-server` 启动时指定的 `advertise-client-urls` 参数。多个 `pd-server` 会包含多个该参数,用户可以指定其中任意一个或多个参数。例如 `--pd=http://10.0.10.25:2379``--pd=http://10.0.10.25:2379,http://10.0.10.26:2379,http://10.0.10.27:2379`
如果你使用的 TiCDC 是用 TiUP 部署的,需要将以下命令中的 `cdc cli` 替换为 `tiup ctl cdc`

### 管理 TiCDC 服务进程 (`capture`)
Expand Down Expand Up @@ -421,9 +425,9 @@ TiCDC 从 4.0.4 开始支持非动态修改同步任务配置,修改 changefee
{{< copyable "shell-regular" >}}

```shell
cdc cli changefeed pause -c test-cf
cdc cli changefeed update -c test-cf --sink-uri="mysql://127.0.0.1:3306/?max-txn-row=20&worker-number=8" --config=changefeed.toml
cdc cli changefeed resume -c test-cf
cdc cli changefeed pause -c test-cf --pd=http://10.0.10.25:2379
cdc cli changefeed update -c test-cf --pd=http://10.0.10.25:2379 --sink-uri="mysql://127.0.0.1:3306/?max-txn-row=20&worker-number=8" --config=changefeed.toml
cdc cli changefeed resume -c test-cf --pd=http://10.0.10.25:2379
```

当前支持修改的配置包括:
Expand Down
24 changes: 18 additions & 6 deletions ticdc/troubleshoot-ticdc.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ aliases: ['/docs-cn/dev/ticdc/troubleshoot-ticdc/','/docs-cn/dev/reference/tools

本文档总结了在使用 TiCDC 过程中经常遇到的问题,给出合适的运维方法。本文档还总结了常见的运行故障,并给出相对应的解决方案。

> **注意:**
>
> 本文档 `cdc cli` 命令中指定 PD 地址为 `--pd=http://10.0.10.25:2379`,用户在使用时需根据实际地址进行替换。
## TiCDC 创建任务时如何选择 start-ts?

首先需要理解同步任务的 `start-ts` 对应于上游 TiDB 集群的一个 TSO,同步任务会从这个 TSO 开始请求数据。所以同步任务的 `start-ts` 需要满足以下两个条件:
Expand Down Expand Up @@ -58,7 +62,7 @@ aliases: ['/docs-cn/dev/ticdc/troubleshoot-ticdc/','/docs-cn/dev/reference/tools
{{< copyable "shell-regular" >}}

```shell
cdc cli changefeed update -c [changefeed-id] --sort-engine="unified" --sort-dir="/data/cdc/sort"
cdc cli changefeed update -c [changefeed-id] --sort-engine="unified" --sort-dir="/data/cdc/sort" --pd=http://10.0.10.25:2379
```

> **注意:**
Expand Down Expand Up @@ -113,7 +117,7 @@ show variables like '%time_zone%';
{{< copyable "shell-regular" >}}

```shell
cdc cli changefeed create --sink-uri="mysql://root@127.0.0.1:3306/?time-zone=CST"
cdc cli changefeed create --sink-uri="mysql://root@127.0.0.1:3306/?time-zone=CST" --pd=http://10.0.10.25:2379
```

> **注意:**
Expand Down Expand Up @@ -317,18 +321,26 @@ TiCDC 对大事务(大小超过 5 GB)提供部分支持,根据场景不同
自 v4.0.8 起,如果 changefeed 使用 canal 或者 canal-json 协议输出,TiCDC 会检查是否同时开启了 Old Value 功能。如果没开启则会报错。可以按照以下步骤解决该问题:

1. 将 changefeed 配置文件中 `enable-old-value` 的值设为 `true`
2. 使用 `cdc cli changefeed update` 更新原有 changefeed 的配置。
2. 使用 `cdc cli changefeed pause` 暂停同步任务。

{{< copyable "shell-regular" >}}

```shell
cdc cli changefeed pause -c test-cf --pd=http://10.0.10.25:2379
```

3. 使用 `cdc cli changefeed update` 更新原有 changefeed 的配置。

{{< copyable "shell-regular" >}}

```shell
cdc cli changefeed update -c test-cf --sink-uri="mysql://127.0.0.1:3306/?max-txn-row=20&worker-number=8" --config=changefeed.toml
cdc cli changefeed update -c test-cf --pd=http://10.0.10.25:2379 --sink-uri="mysql://127.0.0.1:3306/?max-txn-row=20&worker-number=8" --config=changefeed.toml
```

3. 使用 `cdc cli changfeed resume` 恢复同步任务。
4. 使用 `cdc cli changefeed resume` 恢复同步任务。

{{< copyable "shell-regular" >}}

```shell
cdc cli changefeed resume -c test-cf
cdc cli changefeed resume -c test-cf --pd=http://10.0.10.25:2379
```

0 comments on commit 6134056

Please sign in to comment.