## 模块 3：移除 TiCDC 集群

### 步骤 1. 在终端 2 中，暂停复制任务

- 切换到 [终端 2](ssh://monitor1-ssh#2)，并执行：

  ```bash
  tiup cdc:v${LAB:TIDB_VERSION} cli changefeed pause --pd=http://${HOST_PD1_PRIVATE_IP}:2379  --changefeed-id replication-task-1
  ```

### 步骤 2. 在终端 2 中，移除复制任务

  ```bash
  tiup cdc:v${LAB:TIDB_VERSION} cli changefeed remove --pd=http://${HOST_PD1_PRIVATE_IP}:2379 --changefeed-id replication-task-1
  ```

### 步骤 3. 在终端 2 中，查询复制任务

  ```bash
  tiup cdc:v${LAB:TIDB_VERSION} cli changefeed list --pd=http://${HOST_PD3_PRIVATE_IP}:2379
  ```

  ```output
  Starting component `cdc`: /home/ec2-user/.tiup/components/cdc/v${LAB:TIDB_VERSION}/cdc cli changefeed list --pd=http://10.80.0.12:2379
  []
  ```

### 步骤 4. 移除 TiCDC 集群

  ```bash
  tiup cluster scale-in tidb-test --node ${HOST_PD1_PRIVATE_IP}:8300 --node ${HOST_PD2_PRIVATE_IP}:8300 --node ${HOST_PD3_PRIVATE_IP}:8300 --yes
  ```

  ```output
  ...
  Scaled cluster `tidb-test` in successfully
  ```

### 步骤 5. 检查 TiDB 集群的状态

  ```bash
  tiup cluster display tidb-test
  ```

  ```output
  tiup is checking updates for component cluster ...
  Starting component `cluster`: /home/ec2-user/.tiup/components/cluster/v1.12.1/tiup-cluster display tidb-test
  Cluster type:       tidb
  Cluster name:       tidb-test
  Cluster version:    v${LAB:TIDB_VERSION}
  Deploy user:        tidb
  SSH type:           builtin
  Dashboard URL:      http://10.90.1.34:2379/dashboard
  Grafana URL:        http://10.90.4.231:3000
  ID                 Role          Host         Ports                            OS/Arch       Status   Data Dir                      Deploy Dir
  --                 ----          ----         -----                            -------       ------   --------                      ----------
  10.90.4.231:9093   alertmanager  10.90.4.231  9093/9094                        linux/x86_64  Up       /tidb-data/alertmanager-9093  /tidb-deploy/alertmanager-9093
  10.90.4.231:3000   grafana       10.90.4.231  3000                             linux/x86_64  Up       -                             /tidb-deploy/grafana-3000
  10.90.1.34:2379    pd            10.90.1.34   2379/2380                        linux/x86_64  Up|L|UI  /tidb-data/pd-2379            /tidb-deploy/pd-2379
  10.90.2.38:2379    pd            10.90.2.38   2379/2380                        linux/x86_64  Up       /tidb-data/pd-2379            /tidb-deploy/pd-2379
  10.90.3.188:2379   pd            10.90.3.188  2379/2380                        linux/x86_64  Up       /tidb-data/pd-2379            /tidb-deploy/pd-2379
  10.90.4.231:9090   prometheus    10.90.4.231  9090/12020                       linux/x86_64  Up       /tidb-data/prometheus-9090    /tidb-deploy/prometheus-9090
  10.90.1.69:4000    tidb          10.90.1.69   4000/10080                       linux/x86_64  Up       -                             /tidb-deploy/tidb-4000
  10.90.2.35:4000    tidb          10.90.2.35   4000/10080                       linux/x86_64  Up       -                             /tidb-deploy/tidb-4000
  10.90.4.53:9000    tiflash       10.90.4.53   9000/8123/3930/20170/20292/8234  linux/x86_64  Up       /tidb-data/tiflash-9000       /tidb-deploy/tiflash-9000
  10.90.1.162:20160  tikv          10.90.1.162  20160/20180                      linux/x86_64  Up       /tidb-data/tikv-20160         /tidb-deploy/tikv-20160
  10.90.2.108:20160  tikv          10.90.2.108  20160/20180                      linux/x86_64  Up       /tidb-data/tikv-20160         /tidb-deploy/tikv-20160
  10.90.3.12:20160   tikv          10.90.3.12   20160/20180                      linux/x86_64  Up       /tidb-data/tikv-20160         /tidb-deploy/tikv-20160
  Total nodes: 12
  ```
