This topic describes how to update the backup configuration of a tenant by using the API.
Request parameters
| Parameter | Type | Required | Example value | Description |
|---|---|---|---|---|
| data_base_uri | string | No | "file:///data/backup/data" | The path for storing data backup files. After this parameter is set, data backup files will be stored in this path. |
| archive_base_uri | string | No | "file:///data/backup/clog" | The path for storing log archive files. After this parameter is set, log archive files will be stored in this path. |
| log_archive_concurrency | int | No | 0 | The total number of worker 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). If this parameter is not specified, Optional mode is used by default. If this parameter is specified, the archive_base_uri parameter must be specified. |
| ha_low_thread_score | int | No | 0 | The current number of worker threads for high availability tasks such as backup and backup cleanup. You can increase this parameter to 2 times its value before you start backup. The default value is 0, and the valid range is [0, 100]. |
| piece_switch_interval | string | No | 1d | The period for switching pieces. If this parameter is not specified, the default value is 1d, and the valid range is [1d, 7d]. If this parameter is specified, the archive_base_uri parameter must be specified. |
| 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", }, } |
After a backup is created, you can set a cleanup policy for the tenant. A tenant with a cleanup policy will trigger automatic cleanup every hour to ensure that expired backups are deleted in time. The following table describes the values of the parameters in the configuration:
|
The difference between updating the backup configuration of a tenant and setting the backup configuration of a tenant is that the data_base_uri and archive_base_uri parameters can be omitted.
Notice
If you want to set the binding and piece_switch_interval parameters, you must set the archive_base_uri parameter, because the three parameters are bound and cannot be set incrementally.
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) 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 generated by the request, which contains the following fields:
|
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 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 DAG execution operation. |
| start_time | time.Time | The start time of the DAG execution. |
| end_time | time.Time | The end time of the DAG execution. |
| additional_data | map[string]any | Other data of the DAG. |
| nodes | []NodeDetailDTO | The information of 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/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 by using SDK methods.
For more information about how to call the API by using obshell-sdk-python, see Update the backup configuration of a tenant.
For more information about how to call the API by using obshell-sdk-go, see Update the backup configuration of a tenant.