Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ticdc-open-api: add ticdc open api doc #6186

Merged
merged 10 commits into from
Aug 19, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@
+ [Maintain](/ticdc/manage-ticdc.md)
+ [Troubleshoot](/ticdc/troubleshoot-ticdc.md)
+ [Monitor](/ticdc/monitor-ticdc.md)
+ [TiCDC Open API](/ticdc/ticdc-open-api.md)
+ [TiCDC Open Protocol](/ticdc/ticdc-open-protocol.md)
+ [Integrate TiDB with Confluent Platform](/ticdc/integrate-confluent-using-ticdc.md)
+ [Glossary](/ticdc/ticdc-glossary.md)
Expand Down
97 changes: 5 additions & 92 deletions ticdc/manage-ticdc.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ aliases: ['/docs/dev/ticdc/manage-ticdc/','/docs/dev/reference/tools/ticdc/manag

# Manage TiCDC Cluster and Replication Tasks

This document describes how to upgrade TiCDC cluster and modify the configuration of TiCDC cluster using TiUP, and how to manage the TiCDC cluster and replication tasks using the command-line tool `cdc cli` and the HTTP interface.
This document describes how to upgrade TiCDC cluster and modify the configuration of TiCDC cluster using TiUP, and how to manage the TiCDC cluster and replication tasks using the command-line tool `cdc cli`.

You can also use the HTTP interface (the TiCDC Open API feature) to manage the TiCDC cluster and replication tasks. For details, see [TiCDC Open API](/ticdc/ticdc-open-api.md).

## Upgrade TiCDC using TiUP

Expand All @@ -29,12 +31,12 @@ tiup cluster upgrade <cluster-name> v5.1.0

This section introduces how to modify the configuration of TiCDC cluster using the [`tiup cluster edit-config`](/tiup/tiup-component-cluster-edit-config.md) command of TiUP. The following example changes the value of `gc-ttl` from the default `86400` to `3600`, namely, one hour.

First, execute the following command. You need to replace `<cluster-name>` with your actual cluster name.
First, execute the following command. You need to replace `<cluster-name>` with your actual cluster name.

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

```shell
tiup cluster edit-config <cluster-name>
tiup cluster edit-config <cluster-name>
```

Then, enter the vi editor page and modify the `cdc` configuraion under [`server-configs`](/tiup/tiup-cluster-topology-reference.md#server_configs). The configuration is shown below:
Expand Down Expand Up @@ -565,95 +567,6 @@ Currently, you can modify the following configuration items:
- `resolved-ts`: The largest TSO among the sorted data in the current processor.
- `checkpoint-ts`: The largest TSO that has been successfully written to the downstream in the current processor.

## Use HTTP interface to manage cluster status and data replication task

Currently, the HTTP interface provides some basic features for query and maintenance.

In the following examples, suppose that the TiCDC server listens on `127.0.0.1`, and the port is `8300` (you can specify the IP and port in `--addr=ip:port` when starting the TiCDC server).

### Get the TiCDC server status

Use the following command to get the TiCDC server status:

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

```shell
curl http://127.0.0.1:8300/status
```

```
{
"version": "0.0.1",
"git_hash": "863f8ea889b144244ff53593a45c47ad22d37396",
"id": "6d92386a-73fc-43f3-89de-4e337a42b766", # capture id
"pid": 12102 # cdc server pid
}
```

### Evict the owner node

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

```shell
curl -X POST http://127.0.0.1:8300/capture/owner/resign
```

The above command takes effect only for requesting on the **owner node**.

```
{
"status": true,
"message": ""
}
```

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

```shell
curl -X POST http://127.0.0.1:8301/capture/owner/resign
```

For nodes other than owner nodes, executing the above command will return the following error.

```
election: not leader
```

### Manually schedule a table to other node

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

```shell
curl -X POST http://127.0.0.1:8300/capture/owner/move_table -d 'cf-id=cf060953-036c-4f31-899f-5afa0ad0c2f9&target-cp-id=6f19a6d9-0f8c-4dc9-b299-3ba7c0f216f5&table-id=49'
```

Parameter description:

| Parameter name | Description |
| :----------- | :--- |
| `cf-id` | The ID of the `changefeed` to be scheduled |
| `target-cp-id` | The ID of the target `capture` |
| `table-id` | The ID of the table to be scheduled |

For nodes other than owner nodes, executing the above command will return the following error.

```
{
"status": true,
"message": ""
}
```

### Dynamically change the log level of TiCDC server

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

```shell
curl -X POST -d '"debug"' http://127.0.0.1:8301/admin/log
```

In the command above, the `POST` parameter indicates the new log level. The [zap-provided](https://godoc.org/go.uber.org/zap#UnmarshalText) log level options are supported: "debug", "info", "warn", "error", "dpanic", "panic", and "fatal". This interface parameter is JSON-encoded and you need to pay attention to the use of quotation marks. For example: `'"debug"'`.

## Task configuration file

This section introduces the configuration of a replication task.
Expand Down
Loading