This topic describes how to update the cluster-level backup configuration by using the API.
Request parameters
| Parameter | Type | Required | Example value | Description |
|---|---|---|---|---|
| backup_base_uri | string | No | "file:///data/backup" | The base URI for storing backup files. After this parameter is set, log archives and data backup files will be stored under this base URI. |
| log_archive_concurrency | int | No | 0 | The total number of threads for logging archiving. The default value is 0, and the valid values range from 0 to 100. |
| binding | string | No | "optional" | The priority mode for archiving and business. Valid values include optional (business takes precedence) and mandatory (archiving takes precedence). The default value is Optional. If you set this parameter, you must set backup_base_uri. |
| ha_low_thread_score | int | No | 0 | The current number of threads for high availability tasks of low priority, such as backup and backup cleanup. You can increase this value before a backup is initiated. We recommend that you double the value each time. The default value is 0, and the valid values range from 0 to 100. |
| piece_switch_interval | string | No | 1d | The period for switching pieces. The default value is 1d, and the valid values range from 1d to 7d. If you set this parameter, you must set backup_base_uri. |
| archive_lag_target | string | No | 7200s | The maximum interval between two consecutive log archive I/Os. The default value is 2 minutes. The valid values range from 0ms to 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 completed. A tenant with a cleanup strategy will trigger an automatic cleanup every hour to delete expired backups. The following table describes the parameters:
|
The difference between updating the cluster-level backup configuration and setting the cluster-level backup configuration is that you do not need to set the backup_base_uri parameter.
Notice
You must set the archive_base_uri, binding, and piece_switch_interval parameters together.
Return result
| 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) for 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 Data structure of DagDetailDTO. |
| error | ApiError | The error information generated by the request. It 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 of the DAG. |
| state | string | The execution status of the DAG. |
| operator | string | The type of 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
PATCH 10.10.10.1:2886/api/v1/obcluster/backup/config
{
"backup_base_uri":"file://data/backup",
"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",
"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 cluster-level backup configuration.
For more information about how to call the API by using obshell-sdk-go, see Update the cluster-level backup configuration.