This topic describes how to modify the attributes of a specified replica through the API, including the replica type, resource specifications of the resource pool, and the number of units. You can modify the attributes of multiple replicas of a tenant at a time.
Request parameters
| Parameter | Type | Required | Example value | Description |
|---|---|---|---|---|
| zone_list | []ModifyReplicaZoneParam | Yes | See the Data structure of ModifyReplicaZoneParam section for more information. | Specifies the attributes of the replica to be modified. |
The data structure of ModifyReplicaZoneParam is as follows:
| Parameter | Type | Required | Example value | Description |
|---|---|---|---|---|
| name | string | Yes | zone1 | The name of the zone. |
| replica_type | string | No | FULL | The replica type of the tenant in the zone. Valid values include FULL (full-featured replica) and READONLY (read-only replica). The default value is FULL. |
| unit_config_name | string | No | s1 | The resource specifications of the resource pool of the tenant in the zone. |
| unit_num | int | No | 1 | The number of units of the tenant in the zone. |
Note
If no attribute is specified, the replica will not be modified.
Response parameters
| Parameter | Type | Description |
|---|---|---|
| successful | bool | Indicates whether the request is successful. |
| timestamp | time.Time | The timestamp when the server completes the request. |
| duration | int | The time (in milliseconds) required by the server to process the request. |
| status | int | The HTTP status code. |
| traceId | string | The Trace ID of the request. |
| data | DagDetailDTO | Information about the asynchronous task. For more information, see the Data structure of DagDetailDTO section. |
| error | ApiError | The error generated by the request. It contains the following information:
|
The data structure of DagDetailDTO is as follows:
| Parameter | Type | Description |
|---|---|---|
| id | string | The common ID of the DAG. |
| dag_id | int | The ID of the DAG, which is the primary key of the record in OceanBase Database. |
| name | string | The name of the DAG. |
| stage | int | The current execution stage of the DAG. |
| max_stage | int | The total number of stages in the execution of the DAG. |
| state | string | The execution status of the DAG. |
| operator | string | The type of the execution operation of the DAG. |
| start_time | time.Time | The start time of the execution of the DAG. |
| end_time | time.Time | The end time of the execution of the DAG. |
| additional_data | map[string]any | Other data of the DAG. |
| nodes | []NodeDetailDTO | Information about all nodes in the DAG. For more information, see Get node information. |
Examples
Request example
PATCH 10.10.10.1:2886/api/v1/tenant/t1/replicas
{
"zone_list": [
{
"zone_name": "zone1",
"replica_type": "READONLY"
}
]
}
Response example
{
"successful": true,
"timestamp": "2024-10-14T10:55:13.075034453+08:00",
"duration": 62,
"status": 200,
"traceId": "f7b0d53ef063568b",
"data": {
"id": "14",
"dag_id": 4,
"name": "Modify tenant replicas",
"stage": 1,
"max_stage": 1,
"state": "READY",
"operator": "RUN",
"start_time": "0001-01-01T00:00:00Z",
"end_time": "0001-01-01T00:00:00Z",
"additional_data": null,
"nodes": null
}
}
References
You can call API interfaces through the CLI or SDK.
For more information about how to call the API through obshell-sdk-python, see Modify a tenant replica.
For more information about how to call the API through obshell-sdk-go, see Modify a tenant replica.