Set cluster-level backup configurations

2025-01-26 09:36:34  Updated

This topic describes how to set cluster-level backup configurations through the API.

Call information

API constraints

If you set a password, you need to authenticate. For more information, see API hybrid encryption.

Request path

POST /api/v1/obcluster/backup/config

Request parameters

Parameter Type Required Example Description
backup_base_uri string Yes "file:///data/backup" The base path for storing backup files. After this parameter is set, log archives and data backup files will be stored under this base path.
log_archive_concurrency int No 0 The total number of concurrent 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 priority) and mandatory (archival priority). If this parameter is not configured, the optional mode is used by default.
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 appropriately before a backup is performed. 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 period for pieces. If this parameter is not configured, the default value is 1d, and the valid range is [1d, 7d].
archive_lag_target string No 7200s The maximum interval between two consecutive log archiving I/O operations. The default value is 2 minutes. Valid values range from 0 ms to 7200 s.
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. Tenants with cleanup strategies will trigger automatic cleanup every hour to ensure that expired backups are cleaned up in time. The following table describes the parameters:
  • policy: the strategy name. The value is default at present.
  • recovery_window: the window time. It indicates the maximum time from the current time to the data that can be restored.

Return result

Parameter Type Description
successful bool Whether the request is successful.
timestamp time.Time The timestamp when the server completes the request.
duration int The time (in ms) that the server takes 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 information:
  • code: the error code.
  • message: the error details.
  • subErrors: the suberrors.

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 DAG execution operation.
start_time time.Time The start time of DAG execution.
end_time time.Time The end time of DAG execution.
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/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 through SDK methods.

Contact Us