From f2a6988c468f0e63c50ff9fa9973283d74fb2053 Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Wed, 18 Aug 2021 11:33:38 +0800 Subject: [PATCH 01/10] ticdc-open-api: add an file about ticdc open api --- TOC.md | 1 + ticdc/manage-ticdc.md | 97 +------ ticdc/ticdc-open-api.md | 615 ++++++++++++++++++++++++++++++++++++++++ ticdc/ticdc-overview.md | 2 +- 4 files changed, 622 insertions(+), 93 deletions(-) create mode 100644 ticdc/ticdc-open-api.md diff --git a/TOC.md b/TOC.md index c9e5dff2e0a3..f26bafe97a82 100644 --- a/TOC.md +++ b/TOC.md @@ -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) diff --git a/ticdc/manage-ticdc.md b/ticdc/manage-ticdc.md index ec6b32168f4c..cbf6efa0fdc4 100644 --- a/ticdc/manage-ticdc.md +++ b/ticdc/manage-ticdc.md @@ -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 @@ -29,12 +31,12 @@ tiup cluster upgrade 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 `` with your actual cluster name. +First, execute the following command. You need to replace `` with your actual cluster name. {{< copyable "shell-regular" >}} ```shell -tiup cluster edit-config +tiup cluster edit-config ``` 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: @@ -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. diff --git a/ticdc/ticdc-open-api.md b/ticdc/ticdc-open-api.md new file mode 100644 index 000000000000..f7cffd496434 --- /dev/null +++ b/ticdc/ticdc-open-api.md @@ -0,0 +1,615 @@ +--- +title: TiCDC Open API +summary: Learn how to use the Open API interface to manage the cluster status and data replication. +--- + +# TiCDC Open API + +> **Warning:** +> +> TiCDC Open API is still an experimental feature. It is not recommended to use it in a production environment. + +TiCDC provides the Open API feature. Using the APIs, you can query and operate the TiCDC cluster. Overall, the Open API feature is similar to that of [`cdc cli` tool] (/ticdc/manage-ticdc.md#use-cdc-cli-to-manage-cluster-status-and-data-replication-task). + +You can use the Open APIs to perform the following maintenance operations on the TiCDC cluster: + +-[Get the status information of a TiCDC node](#get-the-status-information-of-a-ticdc-node) +-[Check the health status of a TiCDC cluster](#check-the-health-status-of-a-ticdc-cluster) +-[Create a replication task](#create-a-replication-task) +-[Remove a replication task](#remove-a-replication-task) +-[Update the replication configuration](#update-the-replication-configuration) +-[Query the replication task list](#query-the-replication-task-list) +-[Query a specific replication task](#query-a-specific-replication-task) +-[Pause a replication task] (#pause-a-replication-task) +-[Resume a replication task](#resume-a-replication-task) +-[Query the replication subtask list](#query-the-replication-subtask-list) +-[Query a specific replication subtask](#query-a-specific-replication-subtask) +-[Query the TiCDC service process list](#query-the-ticdc-service-process-list) +-[Evict an owner node](#evict-an-owner-node) +-[Manually trigger the load balancing of a table] (#manually-trigger-the-load-balancing-of-a-table) +-[Manually schedule a table to another node] (#manually-schedule-a-table-to-another-node) +-[Dynamically adjust the log level of the TiCDC server](#dynamically-adjust-the-log-level-of-the-ticdc-server) + +The request body and returned value of all APIs are in JSON format. The following sections describes the specific usage of the Open APIs. + +In the following examples, the listening IP address of the TiCDC server is `127.0.0.1` and the port is `8300`. You can bind a specified IP and port via `--addr=ip:port` when starting the TiCDC server. + +## API error message template + +After sending an API request, if an error occurs, the returned error message is in the following format: + +```json +{ + "error_msg": "", + "error_code": "" +} +``` + +From the above JSON output, `error_msg` describes the error message and `error_code` is the corresponding error code. + +## Get the status information of a TiCDC node + +This is a synchronous interface. If the request is successful, the status information of the corresponding node is returned. + +### Request URI + +`GET /api/v1/status` + +### Example + +The following request gets the status information of the TiCDC node whose IP address is `127.0.0.1` and port number is `8300`. + +{{< copyable "shell-regular" >}} + +```shell +curl -X GET http://127.0.0.1:8300/api/v1/status +``` + +```json +{ + "version": "v5.2.0-master-dirty", + "git_hash": "f191cd00c53fdf7a2b1c9308a355092f9bf8824e", + "id": "c6a43c16-0717-45af-afd6-8b3e01e44f5d", + "pid": 25432, + "is_owner": true +} +``` + +The fields of the above output are described as follows: + +-version: The current TiCDC version number. +-git_hash: The Git hash value. +-id: The capture ID of the node. +-pid: The capture process PID of the node. +-is_owner: Indicates whether the node is an owner. + +## Check the health status of a TiCDC cluster + +This is a synchronous interface. If the cluster is healthy, `200 OK` is returned. + +### Request URI + +`GET /api/v1/health` + +### Example + +{{< copyable "shell-regular" >}} + +```shell +curl -X GET http://127.0.0.1:8300/api/v1/health +``` + +## Create a replication task + +This is an asynchronous interface. If the request is successful, `202 Accepted` is returned. The returned result only means that the server agrees to run the command but does not guarantee that the command will be run successfully. + +### Request URI + +`POST /api/v1/changefeeds` + +### Parameter description + +The optional parameters for creating a replication task using the API are not as complete as that of using the `cli` command. This API supports the following parameters. + +#### Parameters for the request body + +| Parameter name | Description | +| :------------------------ | :---------------------- ------------------------------- | +| `changefeed_id` | `STRING` type. The ID of the replication task. (Optional) | +| `start_ts` | `UINT64` type. Specifies the start TSO of the changefeed. (Optional) | +| `target_ts` | `UINT64` type. Specifies the target TSO of the changefeed. (Optional) | +| **`sink_uri`** | `STRING` type. The downstream address of the replication task. (**Required**) | +| `force_replicate` | `BOOLEAN` type. Determines whether to forcibly replicate the tables without unique indexes. (Optional) | +| `ignore_ineligible_table` | `BOOLEAN` type. Determines whether to ignore the tables that cannot be replicated. (Optional) | +| `filter_rules` | `STRING` type array. The rules for table schema filtering. (Optional) | +| `ignore_txn_start_ts` | `UINT64` type array. Ignores the transaction of a specified start_ts. (Optional) | +| `mounter_worker_num` | `INT` type. The mounter thread number. (Optional) | +| `sink_config` | The configuration parameters of sink. (Optional) | + +The meaning and format of `changefeed_id`, `start_ts`, `target_ts`, and `sink_uri` are the same as those described in the [Use `cdc cli` to create a replication task](/ticdc/manage-ticdc.md#create-a-replication-task) document. For the detailed description of these parameters, see this document. The following section describes some other parameters in the above table. + +`force_replicate`: This parameter defaults to `false`. When it is specified as `true`, TiCDC tries to forcibly replicate tables that do not have a unique index. + +`ignore_ineligible_table`: This parameter defaults to `false`. When it is specified as `true`, TiCDC ignores tables that cannot be replicated. + +`filter_rules`: The rules for table schema filtering, such as `filter_rules = ['foo*.*','bar*.*']`. For details, see the [Table Filter](/table-filter.md) document. + +`ignore_txn_start_ts`: When this parameter is specified, the specified start_ts is ignored. For example, `ignore-txn-start-ts = [1, 2]`. + +`mounter_worker_num`: The thread number of mounter. mounter is used to decode the data output from TiKV. The default value is `16`. + +The configuration parameters of sink are as follows: + +```json +{ + "dispatchers":[ + {"matcher":["test1.*", "test2.*"], "dispatcher":"ts"}, + {"matcher":["test3.*", "test4.*"], "dispatcher":"rowid"}, + ], + "protocal":"default", +} +``` + +`dispatchers`: For the sink of MQ type, you can use dispatchers to configure the event dispatcher. Four dispatchers are supported: `default`, `ts`, `rowid`, and `table`. The dispatcher rules are as follows: + +- `default`: When multiple unique indexes (including the primary key) exist or the Old Value feature is enabled, events are dispatched in the `table` mode. When only one unique index (or the primary key) exists, events are dispatched in the `rowid` mode. +- `ts`: Uses the commitTs of the row change to create the hash value and dispatch events. +- `rowid`: Uses the name and value of the selected HandleKey column to create the hash value and dispatch events. +- `table`: Uses the schema name of the table and the table name to create the hash value and dispatch events. + +`matcher`: The matching syntax of matcher is the same as the filter rule syntax. + +`protocal`: For the sink of MQ type, you can specify the protocol format of the message. Currently four protocols are supported: `default`, `canal`, `avro`, and `maxwell`. The default protocol is the TiCDC Open Protocol. + +### Example + +The following request creates a replication task with an ID of `test5` and a `sink_uri` of `blackhome://`. + +{{< copyable "shell-regular" >}} + +```shell +curl -X POST -H "'Content-type':'application/json'" http://127.0.0.1:8300/api/v1/changefeeds -d '{"changefeed_id":"test5","sink_uri":"blcakhole://"}' +``` + +If the request is successful, `202 Accepted` is returned. If the request fails, an error message and error code are returned. + +## Remove a replication task + +This is an asynchronous interface. If the request is successful, `202 Accepted` is returned. The returned result only means that the server agrees to run the command but does not guarantee that the command will be run successfully. + +### Request URI + +DELETE /api/v1/changefeeds/{changefeed_id} + +### Parameter description + +#### Path parameters + +| Parameter name | Description | +| :-------------- | :----------------------------------- | +| `changefeed_id` | The ID of the replication task (changefeed) to be deleted. | + +### Example + +The following request removes the replication task with the ID `test1`. + +{{< copyable "shell-regular" >}} + +```shell +curl -X DELETE http://127.0.0.1:8300/api/v1/changefeeds/test1 +``` + +If the request is successful, `202 Accepted` is returned. If the request fails, an error message and error code are returned. + +Update the replication configuration + +This is an asynchronous interface. If the request is successful, `202 Accepted` is returned. The returned result only means that the server agrees to run the command but does not guarantee that the command will be run successfully. + +To modify the changefeed configuration, follow the steps of `pause the replication task -> modify the configuration -> resume the replication task`. + +### Request URI + +PUT /api/v1/changefeeds/{changefeed_id} + +### Parameter description + +#### Path parameters + +| Parameter name | Description | +| :-------------- | :----------------------------------- | +| `changefeed_id` | The ID of the replication task (changefeed) to be queried. | + +#### Parameters for the request body + +Currently, the following configuration can be modified only via the API. + +| Parameter name | Description | +| :-------------------- | :-------------------------- --------------------------- | +| `target_ts` | `UINT64` type. Specifies the target TSO of the changefeed. (Optional) | +| `sink_uri` | `STRING` type. The downstream address of the replication task. (Optional) | +| `filter_rules` | `STRING` type array. The rules for table schema filtering. (Optional) | +| `ignore_txn_start_ts` | `UINT64` type array. Ignores the transaction of a specified start_ts. (Optional) | +| `mounter_worker_num` | `INT` type. The mounter thread number. (Optional) | +| `sink_config` | The configuration parameters of sink. (Optional) | + +The meanings of the above parameters are the same as those in the [Create a replication task](#create-a-replication-task) section. See that section for details. + +### Example + +The following request updates the `mounter_worker_num` of the replication task with the ID `test1` to `32`. + +{{< copyable "shell-regular" >}} + +```shell + curl -X POST -H "'Content-type':'application/json'" http://127.0.0.1:8300/api/v1/changefeeds/test1 -d '{"mounter_worker_num":32}' +``` + +If the request is successful, `202 Accepted` is returned. If the request fails, an error message and error code are returned. + +## Query the replication task list + +This is a synchronous interface. If the request is successful, the basic information of all nodes in the TiCDC cluster is returned. + +### Parameter description + +#### Query parameters + +| Parameter name | Description | +| :------ | :---------------------------------------- ----- | +| `state` | Optional. When this parameter is specified, the replication status information only of this state is returned. | + +The value options for `state` are `all`, `normal`, `stopped`, `error`, `failed`, and `finished`. + +If this parameter is not specified, the basic information of replication tasks in normal, stopped, and failed states is returned by default. + +### Request URI + +`GET /api/v1/changefeeds` + +### Example + +The following request queries the basic information of all replication tasks whose state is `normal`. + +{{< copyable "shell-regular" >}} + +```shell +curl -X GET http://127.0.0.1:8300/api/v1/changefeeds?state=normal +``` + +```json +[ + { + "id": "test1", + "state": "normal", + "checkpoint_tso": 426921294362574849, + "checkpoint_time": "2021-08-10 14:04:54.242", + "error": null + }, + { + "id": "test2", + "state": "normal", + "checkpoint_tso": 426921294362574849, + "checkpoint_time": "2021-08-10 14:04:54.242", + "error": null + } +] +``` + +The fields in the returned result above are described as follows: + +-id: The ID of the replication task. +-state: The current [state](/manage-ticdc.md#state-transfer-of-replication-tasks) of the replication task. +-checkpoint_tso: The TSO representation of the current checkpoint of the replication task. +-checkpoint_tso: The formatted time representation of the current checkpoint of the replication task. +-error: The error information of the replication task. + +## Query a specific replication task + +This is a synchronous interface. If the request is successful, the detailed information of the specified replication task is returned. + +### Request URI + +`GET /api/v1/changefeeds/{changefeed_id}` + +### Parameter description + +#### Path parameters + +| Parameter name | Description | +| :-------------- | :----------------------------------- | +| `changefeed_id` | The ID of the replication task (changefeed) to be queried. | + +### Example + +The following request queries the detailed information of the replication task with the ID `test1`. + +{{< copyable "shell-regular" >}} + +```shell +curl -X GET http://127.0.0.1:8300/api/v1/changefeeds/test1 +``` + +```json +{ + "id": "test1", + "sink_uri": "blackhole://", + "create_time": "2021-08-10 11:41:30.642", + "start_ts": 426919038970232833, + "target_ts": 0, + "checkpoint_tso": 426921014615867393, + "checkpoint_time": "2021-08-10 13:47:07.093", + "sort_engine": "unified", + "state": "normal", + "error": null, + "error_history": null, + "creator_version": "", + "task_status": [ + { + "capture_id": "d8924259-f52f-4dfb-97a9-c48d26395945", + "table_ids": [ + 63, + 65, + ], + "table_operations": {} + } + ] +} +``` + +## Pause a replication task + +This is an asynchronous interface. If the request is successful, `202 Accepted` is returned. The returned result only means that the server agrees to run the command but does not guarantee that the command will be run successfully. + +### Request URI + +`POST /api/v1/changefeeds/{changefeed_id}/pause` + +### Parameter description + +#### Path parameters + +| Parameter name | Description | +| :-------------- | :----------------------------------- | +| `changefeed_id` | The ID of the replication task (changefeed) to be paused. | + +### Example + +The following request pauses the replication task with the ID `test1`. + +{{< copyable "shell-regular" >}} + +```shell +curl -X POST http://127.0.0.1:8300/api/v1/changefeeds/test1/pause +``` + +If the request is successful, `202 Accepted` is returned. If the request fails, an error message and error code are returned. + +## Resume a replication task + +This is an asynchronous interface. If the request is successful, `202 Accepted` is returned. The returned result only means that the server agrees to run the command but does not guarantee that the command will be run successfully. + +### Request URI + +`POST /api/v1/changefeeds/{changefeed_id}/resume` + +### Parameter description + +#### Path parameters + +| Parameter name | Description | +| :-------------- | :----------------------------------- | +| `changefeed_id` | The ID of the replication task (changefeed) to be resumed. | + +### Example + +The following request resumes the replication task with the ID `test1`. + +{{< copyable "shell-regular" >}} + +```shell +curl -X POST http://127.0.0.1:8300/api/v1/changefeeds/test1/resume +``` + +If the request is successful, `202 Accepted` is returned. If the request fails, an error message and error code are returned. + +## Query the replication subtask list + +This is a synchronous interface. If the request is successful, the basic information of all replication subtasks is returned. + +### Request URI + +`GET /api/v1/processors` + +### Example + +{{< copyable "shell-regular" >}} + +```shell +curl -X GET http://127.0.0.1:8300/api/v1/processors +``` + +```json +[ + { + "changefeed_id": "test1", + "capture_id": "561c3784-77f0-4863-ad52-65a3436db6af" + } +] +``` + +## Query a specific replication subtask + +This is a synchronous interface. If the request is successful, the detailed information of the specified replication subtask (`processor`) is returned. + +### Request URI + +`GET /api/v1/processors/{changefeed_id}/{capture_id}` + +### Parameter description + +#### Path parameters + +| Parameter name | Description | +| :-------------- | :----------------------------------- | +| `changefeed_id` | The changefeed ID of the replication subtask to be queried. | +| `capture_id` | The capture ID of the replication subtask to be queried. | + +### Example + +{{< copyable "shell-regular" >}} + +```shell +curl -X GET http://127.0.0.1:8300/api/v1/processors/test1/561c3784-77f0-4863-ad52-65a3436db6af + +``` + +```json +{ + "checkpoint_ts": 426919123303006208, + "resolved_ts": 426919123369066496, + "table_ids": [ + 63, + 65, + ], + "error": null +} +``` + +## Query the TiCDC service process list + +This is a synchronous interface. If the request is successful, the basic information of all replication processes (`capture`) is returned. + +### Request URI + +`GET /api/v1/captures` + +### Example + +{{< copyable "shell-regular" >}} + +```shell +curl -X GET http://127.0.0.1:8300/api/v1/captures +``` + +```json +[ + { + "id": "561c3784-77f0-4863-ad52-65a3436db6af", + "is_owner": true, + "address": "127.0.0.1:8300" + } +] +``` + +## Evict an owner node + +This is an asynchronous interface. If the request is successful, `202 Accepted` is returned. The returned result only means that the server agrees to run the command but does not guarantee that the command will be run successfully. + +### Request URI + +`POST /api/v1/owner/resign` + +### Example + +The following request evicts the current owner node of TiCDC and triggers a new round of elections to generate a new owner node. + +{{< copyable "shell-regular" >}} + +```shell +curl -X POST http://127.0.0.1:8300/api/v1/owner/resign +``` + +If the request is successful, `202 Accepted` is returned. If the request fails, an error message and error code are returned. + +## Manually trigger the load balancing of a table + +This is an asynchronous interface. If the request is successful, `202 Accepted` is returned. The returned result only means that the server agrees to run the command but does not guarantee that the command will be run successfully. + +### Request URI + +`POST /api/v1/changefeeds/{changefeed_id}/tables/rebalance_table` + +### Parameter description + +#### Path parameters + +| Parameter name | Description | +| :-------------- | :----------------------------------- | +| `changefeed_id` | The ID of the replication task (changefeed) to be scheduled. | + +### Example + +The following request triggers the load balancing of the changefeed table with the ID `test1`. + +{{< copyable "shell-regular" >}} + +```shell + curl -X POST http://127.0.0.1:8300/api/v1/changefeeds/test1/tables/rebalance_table +``` + +If the request is successful, `202 Accepted` is returned. If the request fails, an error message and error code are returned. + +## Manually schedule a table to another node + +This is an asynchronous interface. If the request is successful, `202 Accepted` is returned. The returned result only means that the server agrees to run the command but does not guarantee that the command will be run successfully. + +### Request URI + +`POST /api/v1/changefeeds/{changefeed_id}/tables/move_table` + +### Parameter description + +#### Path parameters + +| Parameter name | Description | +| :-------------- | :----------------------------------- | +| `changefeed_id` | The ID of the replication task (changefeed) to be scheduled. | + +#### Parameters for the request body + +| Parameter name | Description | +| :------------------ | :------------------ | +| `target_capture_id` | The ID of the target capture. | +| `table_id` | The ID of the table to be scheduled. | + +### Example + +The following request schedules the table with the ID `49` in the changefeed with the ID `test1` to the capture with the ID `6f19a6d9-0f8c-4dc9-b299-3ba7c0f216f5`. + +{{< copyable "shell-regular" >}} + +```shell +curl -X POST -H "'Content-type':'application/json'" http://127.0.0.1:8300/api/v1/changefeeds/changefeed-test1/tables/move_table -d '{"capture_id":"6f19a6d9-0f8c-4dc9-b299-3ba7c0f216f5","table_id":49}' + +``` + +If the request is successful, `202 Accepted` is returned. If the request fails, an error message and error code are returned. + +## Dynamically adjust the log level of the TiCDC server + +This is a synchronous interface. If the request is successful, `202 OK` is returned. + +### Request URI + +`POST /api/v1/log` + +### Request parameters + +#### Parameters for the request body + +| Parameter name | Description | +| :---------- | :----------------- | +| `log_level` | The log level you want to set. | + +`log_level` supports the [log levels provided by zap](https://godoc.org/go.uber.org/zap#UnmarshalText): "debug", "info", "warn", "error", "dpanic" , "Panic", "fatal". + +### Example + +{{< copyable "shell-regular" >}} + +```shell +curl -X POST -H "'Content-type':'application/json'" http://127.0.0.1:8300/api/v1/log -d '{"log_level":"debug"}' + +``` + +If the request is successful, `202 OK` is returned. If the request fails, an error message and error code are returned. diff --git a/ticdc/ticdc-overview.md b/ticdc/ticdc-overview.md index 2ead1b20abde..5f047c78d7e4 100644 --- a/ticdc/ticdc-overview.md +++ b/ticdc/ticdc-overview.md @@ -120,7 +120,7 @@ You can either deploy TiCDC along with a new TiDB cluster or add the TiCDC compo Currently, you can use the `cdc cli` tool to manage the status of a TiCDC cluster and data replication tasks. For details, see: - [Use `cdc cli` to manage cluster status and data replication task](/ticdc/manage-ticdc.md#use-cdc-cli-to-manage-cluster-status-and-data-replication-task) -- [Use HTTP interface to manage cluster status and data replication task](/ticdc/manage-ticdc.md#use-http-interface-to-manage-cluster-status-and-data-replication-task) +- [Use Open API to manage cluster status and data replication task](/ticdc/ticdc-open-api.md) ## Troubleshoot TiCDC From 553a0b90f0173f2f681c7a84d7dcdc1e359666d8 Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Wed, 18 Aug 2021 11:40:51 +0800 Subject: [PATCH 02/10] fix --- ticdc/ticdc-open-api.md | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/ticdc/ticdc-open-api.md b/ticdc/ticdc-open-api.md index f7cffd496434..95452bd7511c 100644 --- a/ticdc/ticdc-open-api.md +++ b/ticdc/ticdc-open-api.md @@ -5,6 +5,8 @@ summary: Learn how to use the Open API interface to manage the cluster status an # TiCDC Open API + + > **Warning:** > > TiCDC Open API is still an experimental feature. It is not recommended to use it in a production environment. @@ -13,22 +15,22 @@ TiCDC provides the Open API feature. Using the APIs, you can query and operate t You can use the Open APIs to perform the following maintenance operations on the TiCDC cluster: --[Get the status information of a TiCDC node](#get-the-status-information-of-a-ticdc-node) --[Check the health status of a TiCDC cluster](#check-the-health-status-of-a-ticdc-cluster) --[Create a replication task](#create-a-replication-task) --[Remove a replication task](#remove-a-replication-task) --[Update the replication configuration](#update-the-replication-configuration) --[Query the replication task list](#query-the-replication-task-list) --[Query a specific replication task](#query-a-specific-replication-task) --[Pause a replication task] (#pause-a-replication-task) --[Resume a replication task](#resume-a-replication-task) --[Query the replication subtask list](#query-the-replication-subtask-list) --[Query a specific replication subtask](#query-a-specific-replication-subtask) --[Query the TiCDC service process list](#query-the-ticdc-service-process-list) --[Evict an owner node](#evict-an-owner-node) --[Manually trigger the load balancing of a table] (#manually-trigger-the-load-balancing-of-a-table) --[Manually schedule a table to another node] (#manually-schedule-a-table-to-another-node) --[Dynamically adjust the log level of the TiCDC server](#dynamically-adjust-the-log-level-of-the-ticdc-server) +- [Get the status information of a TiCDC node](#get-the-status-information-of-a-ticdc-node) +- [Check the health status of a TiCDC cluster](#check-the-health-status-of-a-ticdc-cluster) +- [Create a replication task](#create-a-replication-task) +- [Remove a replication task](#remove-a-replication-task) +- [Update the replication configuration](#update-the-replication-configuration) +- [Query the replication task list](#query-the-replication-task-list) +- [Query a specific replication task](#query-a-specific-replication-task) +- [Pause a replication task] (#pause-a-replication-task) +- [Resume a replication task](#resume-a-replication-task) +- [Query the replication subtask list](#query-the-replication-subtask-list) +- [Query a specific replication subtask](#query-a-specific-replication-subtask) +- [Query the TiCDC service process list](#query-the-ticdc-service-process-list) +- [Evict an owner node](#evict-an-owner-node) +- [Manually trigger the load balancing of a table](#manually-trigger-the-load-balancing-of-a-table) +- [Manually schedule a table to another node](#manually-schedule-a-table-to-another-node) +- [Dynamically adjust the log level of the TiCDC server](#dynamically-adjust-the-log-level-of-the-ticdc-server) The request body and returned value of all APIs are in JSON format. The following sections describes the specific usage of the Open APIs. @@ -179,7 +181,7 @@ This is an asynchronous interface. If the request is successful, `202 Accepted` ### Request URI -DELETE /api/v1/changefeeds/{changefeed_id} +`DELETE /api/v1/changefeeds/{changefeed_id}` ### Parameter description @@ -209,7 +211,7 @@ To modify the changefeed configuration, follow the steps of `pause the replicati ### Request URI -PUT /api/v1/changefeeds/{changefeed_id} +`PUT /api/v1/changefeeds/{changefeed_id}` ### Parameter description From f42dc59117a2609c3e2d0a35c7c3ffe97a2cb49f Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Wed, 18 Aug 2021 11:42:28 +0800 Subject: [PATCH 03/10] fix --- ticdc/ticdc-open-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ticdc/ticdc-open-api.md b/ticdc/ticdc-open-api.md index 95452bd7511c..089bc08e077c 100644 --- a/ticdc/ticdc-open-api.md +++ b/ticdc/ticdc-open-api.md @@ -300,7 +300,7 @@ curl -X GET http://127.0.0.1:8300/api/v1/changefeeds?state=normal The fields in the returned result above are described as follows: -id: The ID of the replication task. --state: The current [state](/manage-ticdc.md#state-transfer-of-replication-tasks) of the replication task. +-state: The current [state](/ticdc/manage-ticdc.md#state-transfer-of-replication-tasks) of the replication task. -checkpoint_tso: The TSO representation of the current checkpoint of the replication task. -checkpoint_tso: The formatted time representation of the current checkpoint of the replication task. -error: The error information of the replication task. From f6a4445674f35b92871c3896ccb7dac509679fca Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Wed, 18 Aug 2021 11:45:51 +0800 Subject: [PATCH 04/10] fix --- ticdc/ticdc-open-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ticdc/ticdc-open-api.md b/ticdc/ticdc-open-api.md index 089bc08e077c..614410c26359 100644 --- a/ticdc/ticdc-open-api.md +++ b/ticdc/ticdc-open-api.md @@ -203,7 +203,7 @@ curl -X DELETE http://127.0.0.1:8300/api/v1/changefeeds/test1 If the request is successful, `202 Accepted` is returned. If the request fails, an error message and error code are returned. -Update the replication configuration +## Update the replication configuration This is an asynchronous interface. If the request is successful, `202 Accepted` is returned. The returned result only means that the server agrees to run the command but does not guarantee that the command will be run successfully. From 68da1499835791db02a6f622691adf4ad4956c49 Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Wed, 18 Aug 2021 11:55:06 +0800 Subject: [PATCH 05/10] Update ticdc/ticdc-open-api.md --- ticdc/ticdc-open-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ticdc/ticdc-open-api.md b/ticdc/ticdc-open-api.md index 614410c26359..d56b6b704a08 100644 --- a/ticdc/ticdc-open-api.md +++ b/ticdc/ticdc-open-api.md @@ -11,7 +11,7 @@ summary: Learn how to use the Open API interface to manage the cluster status an > > TiCDC Open API is still an experimental feature. It is not recommended to use it in a production environment. -TiCDC provides the Open API feature. Using the APIs, you can query and operate the TiCDC cluster. Overall, the Open API feature is similar to that of [`cdc cli` tool] (/ticdc/manage-ticdc.md#use-cdc-cli-to-manage-cluster-status-and-data-replication-task). +TiCDC provides the Open API feature for querying and operating the TiCDC cluster, which is similar to that of [`cdc cli` tool] (/ticdc/manage-ticdc.md#use-cdc-cli-to-manage-cluster-status-and-data-replication-task). You can use the Open APIs to perform the following maintenance operations on the TiCDC cluster: From 244aabe42b9bfc45ee5e2156d9ac553605a9c98c Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Wed, 18 Aug 2021 14:40:49 +0800 Subject: [PATCH 06/10] Apply suggestions from code review --- ticdc/ticdc-open-api.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/ticdc/ticdc-open-api.md b/ticdc/ticdc-open-api.md index d56b6b704a08..5ca478abaea6 100644 --- a/ticdc/ticdc-open-api.md +++ b/ticdc/ticdc-open-api.md @@ -22,7 +22,7 @@ You can use the Open APIs to perform the following maintenance operations on the - [Update the replication configuration](#update-the-replication-configuration) - [Query the replication task list](#query-the-replication-task-list) - [Query a specific replication task](#query-a-specific-replication-task) -- [Pause a replication task] (#pause-a-replication-task) +- [Pause a replication task](#pause-a-replication-task) - [Resume a replication task](#resume-a-replication-task) - [Query the replication subtask list](#query-the-replication-subtask-list) - [Query a specific replication subtask](#query-a-specific-replication-subtask) @@ -32,7 +32,7 @@ You can use the Open APIs to perform the following maintenance operations on the - [Manually schedule a table to another node](#manually-schedule-a-table-to-another-node) - [Dynamically adjust the log level of the TiCDC server](#dynamically-adjust-the-log-level-of-the-ticdc-server) -The request body and returned value of all APIs are in JSON format. The following sections describes the specific usage of the Open APIs. +The request body and returned value of all APIs are in JSON format. The following sections describe the specific usage of the APIs. In the following examples, the listening IP address of the TiCDC server is `127.0.0.1` and the port is `8300`. You can bind a specified IP and port via `--addr=ip:port` when starting the TiCDC server. @@ -79,11 +79,11 @@ curl -X GET http://127.0.0.1:8300/api/v1/status The fields of the above output are described as follows: --version: The current TiCDC version number. --git_hash: The Git hash value. --id: The capture ID of the node. --pid: The capture process PID of the node. --is_owner: Indicates whether the node is an owner. +- version: The current TiCDC version number. +- git_hash: The Git hash value. +- id: The capture ID of the node. +- pid: The capture process PID of the node. +- is_owner: Indicates whether the node is an owner. ## Check the health status of a TiCDC cluster @@ -111,7 +111,7 @@ This is an asynchronous interface. If the request is successful, `202 Accepted` ### Parameter description -The optional parameters for creating a replication task using the API are not as complete as that of using the `cli` command. This API supports the following parameters. +Compared to the optional parameters for creating a replication task using the `cli` command, the optional parameters for such task creation using the API are not as complete. This API supports the following parameters. #### Parameters for the request body @@ -128,7 +128,7 @@ The optional parameters for creating a replication task using the API are not as | `mounter_worker_num` | `INT` type. The mounter thread number. (Optional) | | `sink_config` | The configuration parameters of sink. (Optional) | -The meaning and format of `changefeed_id`, `start_ts`, `target_ts`, and `sink_uri` are the same as those described in the [Use `cdc cli` to create a replication task](/ticdc/manage-ticdc.md#create-a-replication-task) document. For the detailed description of these parameters, see this document. The following section describes some other parameters in the above table. +The meaning and format of `changefeed_id`, `start_ts`, `target_ts`, and `sink_uri` are the same as those described in the [Use `cdc cli` to create a replication task](/ticdc/manage-ticdc.md#create-a-replication-task) document. For the detailed description of these parameters, see this document. Some other parameters in the above table are described as follows. `force_replicate`: This parameter defaults to `false`. When it is specified as `true`, TiCDC tries to forcibly replicate tables that do not have a unique index. @@ -299,11 +299,11 @@ curl -X GET http://127.0.0.1:8300/api/v1/changefeeds?state=normal The fields in the returned result above are described as follows: --id: The ID of the replication task. --state: The current [state](/ticdc/manage-ticdc.md#state-transfer-of-replication-tasks) of the replication task. --checkpoint_tso: The TSO representation of the current checkpoint of the replication task. --checkpoint_tso: The formatted time representation of the current checkpoint of the replication task. --error: The error information of the replication task. +- id: The ID of the replication task. +- state: The current [state](/ticdc/manage-ticdc.md#state-transfer-of-replication-tasks) of the replication task. +- checkpoint_tso: The TSO representation of the current checkpoint of the replication task. +- checkpoint_tso: The formatted time representation of the current checkpoint of the replication task. +- error: The error information of the replication task. ## Query a specific replication task From d59917e7ea02dd28bfad31238501d92991320c17 Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Thu, 19 Aug 2021 16:02:57 +0800 Subject: [PATCH 07/10] Apply suggestions from code review Co-authored-by: Liuxiaozhen12 <82579298+Liuxiaozhen12@users.noreply.github.com> Co-authored-by: dongmen <20351731+asddongmen@users.noreply.github.com> --- ticdc/ticdc-open-api.md | 58 ++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/ticdc/ticdc-open-api.md b/ticdc/ticdc-open-api.md index 5ca478abaea6..cdbc3eee101d 100644 --- a/ticdc/ticdc-open-api.md +++ b/ticdc/ticdc-open-api.md @@ -11,7 +11,7 @@ summary: Learn how to use the Open API interface to manage the cluster status an > > TiCDC Open API is still an experimental feature. It is not recommended to use it in a production environment. -TiCDC provides the Open API feature for querying and operating the TiCDC cluster, which is similar to that of [`cdc cli` tool] (/ticdc/manage-ticdc.md#use-cdc-cli-to-manage-cluster-status-and-data-replication-task). +TiCDC provides the Open API feature for querying and operating the TiCDC cluster, which is similar to the feature of [`cdc cli` tool] (/ticdc/manage-ticdc.md#use-cdc-cli-to-manage-cluster-status-and-data-replication-task). You can use the Open APIs to perform the following maintenance operations on the TiCDC cluster: @@ -28,7 +28,7 @@ You can use the Open APIs to perform the following maintenance operations on the - [Query a specific replication subtask](#query-a-specific-replication-subtask) - [Query the TiCDC service process list](#query-the-ticdc-service-process-list) - [Evict an owner node](#evict-an-owner-node) -- [Manually trigger the load balancing of a table](#manually-trigger-the-load-balancing-of-a-table) +- [Manually trigger the load balancing of all tables in a replication task](#manually-trigger-the-load-balancing-of-all-tables-in-a-replication-task) - [Manually schedule a table to another node](#manually-schedule-a-table-to-another-node) - [Dynamically adjust the log level of the TiCDC server](#dynamically-adjust-the-log-level-of-the-ticdc-server) @@ -51,7 +51,7 @@ From the above JSON output, `error_msg` describes the error message and `error_c ## Get the status information of a TiCDC node -This is a synchronous interface. If the request is successful, the status information of the corresponding node is returned. +This API is a synchronous interface. If the request is successful, the status information of the corresponding node is returned. ### Request URI @@ -87,7 +87,7 @@ The fields of the above output are described as follows: ## Check the health status of a TiCDC cluster -This is a synchronous interface. If the cluster is healthy, `200 OK` is returned. +This API is a synchronous interface. If the cluster is healthy, `200 OK` is returned. ### Request URI @@ -103,7 +103,7 @@ curl -X GET http://127.0.0.1:8300/api/v1/health ## Create a replication task -This is an asynchronous interface. If the request is successful, `202 Accepted` is returned. The returned result only means that the server agrees to run the command but does not guarantee that the command will be run successfully. +This API is an asynchronous interface. If the request is successful, `202 Accepted` is returned. The returned result only means that the server agrees to run the command but does not guarantee that the command will be run successfully. ### Request URI @@ -111,7 +111,7 @@ This is an asynchronous interface. If the request is successful, `202 Accepted` ### Parameter description -Compared to the optional parameters for creating a replication task using the `cli` command, the optional parameters for such task creation using the API are not as complete. This API supports the following parameters. +Compared to the optional parameters for creating a replication task using the `cli` command, the optional parameters for creating such task using the API are not as complete. This API supports the following parameters. #### Parameters for the request body @@ -128,7 +128,7 @@ Compared to the optional parameters for creating a replication task using the `c | `mounter_worker_num` | `INT` type. The mounter thread number. (Optional) | | `sink_config` | The configuration parameters of sink. (Optional) | -The meaning and format of `changefeed_id`, `start_ts`, `target_ts`, and `sink_uri` are the same as those described in the [Use `cdc cli` to create a replication task](/ticdc/manage-ticdc.md#create-a-replication-task) document. For the detailed description of these parameters, see this document. Some other parameters in the above table are described as follows. +The meaning and format of `changefeed_id`, `start_ts`, `target_ts`, and `sink_uri` are the same as those described in the [Use `cdc cli` to create a replication task](/ticdc/manage-ticdc.md#create-a-replication-task) document. For the detailed description of these parameters, see this document. Some other parameters in the above table are described further as follows. `force_replicate`: This parameter defaults to `false`. When it is specified as `true`, TiCDC tries to forcibly replicate tables that do not have a unique index. @@ -138,7 +138,7 @@ The meaning and format of `changefeed_id`, `start_ts`, `target_ts`, and `sink_ur `ignore_txn_start_ts`: When this parameter is specified, the specified start_ts is ignored. For example, `ignore-txn-start-ts = [1, 2]`. -`mounter_worker_num`: The thread number of mounter. mounter is used to decode the data output from TiKV. The default value is `16`. +`mounter_worker_num`: The thread number of mounter. Mounter is used to decode the data output from TiKV. The default value is `16`. The configuration parameters of sink are as follows: @@ -177,7 +177,7 @@ If the request is successful, `202 Accepted` is returned. If the request fails, ## Remove a replication task -This is an asynchronous interface. If the request is successful, `202 Accepted` is returned. The returned result only means that the server agrees to run the command but does not guarantee that the command will be run successfully. +This API is an asynchronous interface. If the request is successful, `202 Accepted` is returned. The returned result only means that the server agrees to run the command but does not guarantee that the command will be run successfully. ### Request URI @@ -189,7 +189,7 @@ This is an asynchronous interface. If the request is successful, `202 Accepted` | Parameter name | Description | | :-------------- | :----------------------------------- | -| `changefeed_id` | The ID of the replication task (changefeed) to be deleted. | +| `changefeed_id` | The ID of the replication task (changefeed) to be removed. | ### Example @@ -205,7 +205,7 @@ If the request is successful, `202 Accepted` is returned. If the request fails, ## Update the replication configuration -This is an asynchronous interface. If the request is successful, `202 Accepted` is returned. The returned result only means that the server agrees to run the command but does not guarantee that the command will be run successfully. +This API is an asynchronous interface. If the request is successful, `202 Accepted` is returned. The returned result only means that the server agrees to run the command but does not guarantee that the command will be run successfully. To modify the changefeed configuration, follow the steps of `pause the replication task -> modify the configuration -> resume the replication task`. @@ -219,11 +219,11 @@ To modify the changefeed configuration, follow the steps of `pause the replicati | Parameter name | Description | | :-------------- | :----------------------------------- | -| `changefeed_id` | The ID of the replication task (changefeed) to be queried. | +| `changefeed_id` | The ID of the replication task (changefeed) to be updated. | #### Parameters for the request body -Currently, the following configuration can be modified only via the API. +Currently, only the following configuration can be modified via the API. | Parameter name | Description | | :-------------------- | :-------------------------- --------------------------- | @@ -250,7 +250,7 @@ If the request is successful, `202 Accepted` is returned. If the request fails, ## Query the replication task list -This is a synchronous interface. If the request is successful, the basic information of all nodes in the TiCDC cluster is returned. +This API is a synchronous interface. If the request is successful, the basic information of all nodes in the TiCDC cluster is returned. ### Parameter description @@ -258,11 +258,11 @@ This is a synchronous interface. If the request is successful, the basic informa | Parameter name | Description | | :------ | :---------------------------------------- ----- | -| `state` | Optional. When this parameter is specified, the replication status information only of this state is returned. | +| `state` | When this parameter is specified, the replication status information only of this state is returned.(Optional) | The value options for `state` are `all`, `normal`, `stopped`, `error`, `failed`, and `finished`. -If this parameter is not specified, the basic information of replication tasks in normal, stopped, and failed states is returned by default. +If this parameter is not specified, the basic information of replication tasks whose state is normal, stopped, or failed is returned by default. ### Request URI @@ -307,7 +307,7 @@ The fields in the returned result above are described as follows: ## Query a specific replication task -This is a synchronous interface. If the request is successful, the detailed information of the specified replication task is returned. +This API is a synchronous interface. If the request is successful, the detailed information of the specified replication task is returned. ### Request URI @@ -360,7 +360,7 @@ curl -X GET http://127.0.0.1:8300/api/v1/changefeeds/test1 ## Pause a replication task -This is an asynchronous interface. If the request is successful, `202 Accepted` is returned. The returned result only means that the server agrees to run the command but does not guarantee that the command will be run successfully. +This API is an asynchronous interface. If the request is successful, `202 Accepted` is returned. The returned result only means that the server agrees to run the command but does not guarantee that the command will be run successfully. ### Request URI @@ -388,7 +388,7 @@ If the request is successful, `202 Accepted` is returned. If the request fails, ## Resume a replication task -This is an asynchronous interface. If the request is successful, `202 Accepted` is returned. The returned result only means that the server agrees to run the command but does not guarantee that the command will be run successfully. +This API is an asynchronous interface. If the request is successful, `202 Accepted` is returned. The returned result only means that the server agrees to run the command but does not guarantee that the command will be run successfully. ### Request URI @@ -416,7 +416,7 @@ If the request is successful, `202 Accepted` is returned. If the request fails, ## Query the replication subtask list -This is a synchronous interface. If the request is successful, the basic information of all replication subtasks is returned. +This API is a synchronous interface. If the request is successful, the basic information of all replication subtasks (`processor`) is returned. ### Request URI @@ -441,7 +441,7 @@ curl -X GET http://127.0.0.1:8300/api/v1/processors ## Query a specific replication subtask -This is a synchronous interface. If the request is successful, the detailed information of the specified replication subtask (`processor`) is returned. +This API is a synchronous interface. If the request is successful, the detailed information of the specified replication subtask (`processor`) is returned. ### Request URI @@ -479,7 +479,7 @@ curl -X GET http://127.0.0.1:8300/api/v1/processors/test1/561c3784-77f0-4863-ad5 ## Query the TiCDC service process list -This is a synchronous interface. If the request is successful, the basic information of all replication processes (`capture`) is returned. +This API is a synchronous interface. If the request is successful, the basic information of all replication processes (`capture`) is returned. ### Request URI @@ -505,7 +505,7 @@ curl -X GET http://127.0.0.1:8300/api/v1/captures ## Evict an owner node -This is an asynchronous interface. If the request is successful, `202 Accepted` is returned. The returned result only means that the server agrees to run the command but does not guarantee that the command will be run successfully. +This API is an asynchronous interface. If the request is successful, `202 Accepted` is returned. The returned result only means that the server agrees to run the command but does not guarantee that the command will be run successfully. ### Request URI @@ -523,9 +523,9 @@ curl -X POST http://127.0.0.1:8300/api/v1/owner/resign If the request is successful, `202 Accepted` is returned. If the request fails, an error message and error code are returned. -## Manually trigger the load balancing of a table +## Manually trigger the load balancing of all tables in a replication task -This is an asynchronous interface. If the request is successful, `202 Accepted` is returned. The returned result only means that the server agrees to run the command but does not guarantee that the command will be run successfully. +This API is an asynchronous interface. If the request is successful, `202 Accepted` is returned. The returned result only means that the server agrees to run the command but does not guarantee that the command will be run successfully. ### Request URI @@ -541,7 +541,7 @@ This is an asynchronous interface. If the request is successful, `202 Accepted` ### Example -The following request triggers the load balancing of the changefeed table with the ID `test1`. +The following request triggers the load balancing of all tables in the changefeed with the ID `test1`. {{< copyable "shell-regular" >}} @@ -553,7 +553,7 @@ If the request is successful, `202 Accepted` is returned. If the request fails, ## Manually schedule a table to another node -This is an asynchronous interface. If the request is successful, `202 Accepted` is returned. The returned result only means that the server agrees to run the command but does not guarantee that the command will be run successfully. +This API is an asynchronous interface. If the request is successful, `202 Accepted` is returned. The returned result only means that the server agrees to run the command but does not guarantee that the command will be run successfully. ### Request URI @@ -589,7 +589,7 @@ If the request is successful, `202 Accepted` is returned. If the request fails, ## Dynamically adjust the log level of the TiCDC server -This is a synchronous interface. If the request is successful, `202 OK` is returned. +This API is a synchronous interface. If the request is successful, `202 OK` is returned. ### Request URI @@ -603,7 +603,7 @@ This is a synchronous interface. If the request is successful, `202 OK` is retur | :---------- | :----------------- | | `log_level` | The log level you want to set. | -`log_level` supports the [log levels provided by zap](https://godoc.org/go.uber.org/zap#UnmarshalText): "debug", "info", "warn", "error", "dpanic" , "Panic", "fatal". +`log_level` supports the [log levels provided by zap](https://godoc.org/go.uber.org/zap#UnmarshalText): "debug", "info", "warn", "error", "dpanic" , "panic", and "fatal". ### Example From 3ca7a69e5633d4755c1c40827d3044f13a194530 Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Thu, 19 Aug 2021 16:04:33 +0800 Subject: [PATCH 08/10] Update ticdc-open-api.md --- ticdc/ticdc-open-api.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ticdc/ticdc-open-api.md b/ticdc/ticdc-open-api.md index cdbc3eee101d..83646de7b869 100644 --- a/ticdc/ticdc-open-api.md +++ b/ticdc/ticdc-open-api.md @@ -252,6 +252,10 @@ If the request is successful, `202 Accepted` is returned. If the request fails, This API is a synchronous interface. If the request is successful, the basic information of all nodes in the TiCDC cluster is returned. +### Request URI + +`GET /api/v1/changefeeds` + ### Parameter description #### Query parameters @@ -264,10 +268,6 @@ The value options for `state` are `all`, `normal`, `stopped`, `error`, `failed`, If this parameter is not specified, the basic information of replication tasks whose state is normal, stopped, or failed is returned by default. -### Request URI - -`GET /api/v1/changefeeds` - ### Example The following request queries the basic information of all replication tasks whose state is `normal`. From 79bf984338824be01d3f66f9c99e1bf2432ff043 Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Thu, 19 Aug 2021 16:14:20 +0800 Subject: [PATCH 09/10] Update ticdc/ticdc-open-api.md --- ticdc/ticdc-open-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ticdc/ticdc-open-api.md b/ticdc/ticdc-open-api.md index 83646de7b869..552476f91201 100644 --- a/ticdc/ticdc-open-api.md +++ b/ticdc/ticdc-open-api.md @@ -457,7 +457,7 @@ This API is a synchronous interface. If the request is successful, the detailed | `capture_id` | The capture ID of the replication subtask to be queried. | ### Example - +The following request queries the detailed information of a subtask whose `changefeed_id` is `test` and `capture_id` is `561c3784-77f0-4863-ad52-65a3436db6af`. A subtask can be indentifed by `changefeed_id` and `capture_id`. {{< copyable "shell-regular" >}} ```shell From 581df088c4d2465b2dc6ebbbc41332e5a871d58d Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Thu, 19 Aug 2021 16:18:24 +0800 Subject: [PATCH 10/10] Apply suggestions from code review --- ticdc/ticdc-open-api.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ticdc/ticdc-open-api.md b/ticdc/ticdc-open-api.md index 552476f91201..b87f901a3dd7 100644 --- a/ticdc/ticdc-open-api.md +++ b/ticdc/ticdc-open-api.md @@ -457,12 +457,13 @@ This API is a synchronous interface. If the request is successful, the detailed | `capture_id` | The capture ID of the replication subtask to be queried. | ### Example + The following request queries the detailed information of a subtask whose `changefeed_id` is `test` and `capture_id` is `561c3784-77f0-4863-ad52-65a3436db6af`. A subtask can be indentifed by `changefeed_id` and `capture_id`. + {{< copyable "shell-regular" >}} ```shell curl -X GET http://127.0.0.1:8300/api/v1/processors/test1/561c3784-77f0-4863-ad52-65a3436db6af - ``` ```json