This topic describes how to set the backup configuration for a tenant through an API.
Request parameters
| Parameter | Type | Required | Example value | Description |
|---|---|---|---|---|
| data_base_uri | string | Yes | "file:///data/backup/data" | The path for storing data backup files. After the configuration is set, data backup files will be stored in this path. |
| archive_base_uri | string | Yes | "file:///data/backup/clog" | The path for storing log archive files. After the configuration is set, log archive files will be stored in this path. |
| log_archive_concurrency | int | No | 0 | The total number of work threads for log archiving. The default value is 0, and the valid range is [0, 100]. |
| binding | string | No | "optional" | The priority mode for archiving and business. Valid values include optional (business takes priority) and mandatory (archiving takes priority). The default value is Optional. |
| ha_low_thread_score | int | No | 0 | The number of current work threads for high availability tasks such as backup and backup cleanup. You can increase this value before you start a backup. We recommend that you double the value each time. The default value is 0, and the valid range is [0, 100]. |
| piece_switch_interval | string | No | 1d | The switching cycle for pieces. If this parameter is not specified, the default value is 1d, and the valid range is [1d, 7d]. |
| archive_lag_target | string | No | 7200s | The maximum allowed latency for log archiving. The default value is 2 minutes, which indicates the maximum allowed interval between two consecutive I/Os for log archiving. The valid range is [0ms, 7200s]. |
| delete_policy | DeletePolicy | No | { "delete_policy": "{ "policy": "default", "recovery_window": "7d", }, } |
You can set a cleanup strategy for a tenant after a backup is successful. A tenant with a cleanup strategy will trigger an automatic cleanup every hour to clean up expired backups. The following table describes the parameters in the configuration:
|
Response parameters
| Parameter | Type | Description |
|---|---|---|
| successful | bool | Indicates whether the request is successful. |
| timestamp | time.Time | The timestamp when the request is completed on the server. |
| duration | int | The time (in milliseconds) taken by the server to process the request. |
| status | int | The HTTP status code. |
| traceId | string | The Trace ID of the request. |
| data | DagDetailDTO | The asynchronous task information. For more information, see the Data structure of DagDetailDTO section. |
| error | ApiError | The error information returned by the request, which contains the following information:
|
The data structure of DagDetailDTO is described 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 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 process 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 details. |
Examples
Request example
POST 10.10.10.1:2886/api/v1/tenant/t1/backup/config
{
"data_base_uri":"file:///data/backup/tenant/data",
"archive_base_uri":"file:///data/backup/tenant/archive",
"log_archive_concurrency":100,
"binding":"Mandatory",
"ha_low_thread_score":35,
"piece_switch_interval":"6d",
"archive_lag_target":"2h",
"delete_policy":
{
"policy":"",
"recovery_window":"5d"
}
}
Response example
{
"successful": true,
"timestamp": "2024-01-09T17:11:43.385889278+08:00",
"duration": 1,
"status": 200,
"traceId": "877fe32b83634153",
"data": {
"id": "22130706433028869",
"dag_id": 4,
"name": "Set obcluster backup config for t1",
"stage": 1,
"max_stage": 2,
"state": "READY",
"operator": "RUN",
"start_time": "2024-01-09T17:11:43.384630643+08:00",
"end_time": "2024-01-09T17:11:43.384630643+08:00",
"additional_data": null,
"nodes": null
}
}
References
You can also call the API through SDK methods.
For more information about how to call the API through obshell-sdk-python, see Set the backup configuration for a tenant.
For more information about how to call the API through obshell-sdk-go, see Set the backup configuration for a tenant.