Feature description
This API is used to modify the backup strategy of a cluster. You can use this API to modify the backup schedule period, time, and storage address of the cluster, as well as the expired data cleanup, alert threshold, and secondary backup configuration.
Call instructions
Interface constraints
The caller must have the permissions for backup, restore, and update of the cluster.
The caller needs to be authenticated through OCP application services.
Request path
PATCH /api/v2/ob/clusters/{id}/backup/config/backupStrategy
path:
Parameter |
Type |
Required |
Example Value |
Description |
|---|---|---|---|---|
| id | Integer | Yes | 1 | The ID of the cluster whose backup strategy needs to be modified. |
Request parameters
Parameter |
Type |
Required |
Example Value |
Description |
|---|---|---|---|---|
| backupMode | String | Yes | LOGICAL_BACKUP | The backup mode. Valid values: |
| obBackupScheduleConfig | Object | Yes | NA | The backup schedule configuration. For more information, see Data structure of obBackupScheduleConfig. |
| obBackupThresholdConfig | Object | Yes | NA | The backup alert threshold configuration. For more information, see Data structure of obBackupThresholdConfig. |
| obBackupServiceStorageConfig | Object | Yes | NA | The backup storage configuration. For more information, see Data structure of obBackupServiceStorageConfig. |
| secondaryBackupEnabled | Boolean | No | false | The secondary backup switch. The default value is false. OceanBase Database V2.2.77 and later support secondary backup. |
| obSecondaryBackupConfig | Object | No | NA | The secondary backup configuration. For more information, see Data structure of obSecondaryBackupConfig. |
Data structure of obBackupScheduleConfig
Parameter |
Type |
Required |
Description |
|---|---|---|---|
| backupScheduleMode | String | Yes | The backup schedule cycle. Valid values: WEEK and MONTH. |
| backupScheduleEnabled | Boolean | Yes | The backup switch. |
| backupScheduleTime | OffsetTime | Yes | The backup schedule time, for example, "02:00:00.000+08:00". |
| dayAndDataBackupModelMap | Map | Yes | The mapping between the schedule days and the data backup modes. For example, { "2": "FULL_BACKUP", "4": "FULL_BACKUP", "6": "INCREMENTAL_BACKUP" } indicates that full data backups are performed on Tuesday, Thursday, and Saturday, and incremental data backups are performed on Saturday. |
| startLogBackup | Boolean | Yes | Specifies whether to enable log backup. Generally, this parameter is set to true. |
| cleanEnabled | Boolean | No | The switch for expired data cleanup. |
| backupDataRetentionDays | Long | No | The number of days for which backup data is retained. If you set this parameter to 7, at least the last 7 days of backup data is retained. This parameter is valid only when cleanEnabled is set to true. |
| cleanScheduleTime | OffsetTime | No | The schedule time for expired data cleanup. |
Data structure of obBackupThresholdConfig
Parameter |
Type |
Required |
Description |
|---|---|---|---|
| dataBackupTimeoutMinutes | Long | Yes | The timeout period for data backup, in minutes. |
| noSuccessfulDataBackupAlarmDays | Long | Yes | The maximum number of days for which no successful data backup triggers an alert. |
| libObLogExpireDays | Long | No | The retention period for liboblog. This parameter is valid only in logical backup mode. |
| logBackupDelaySeconds | Long | Yes | The log backup delay alert threshold, in seconds. |
Data structure of obBackupServiceStorageConfig
Parameter |
Type |
Required |
Description |
|---|---|---|---|
| configName | String | Yes | The storage configuration name. |
| obBackupStorageBaseInfo | Object | Yes | The basic parameters of the storage configuration. |
| |--backupStorageType | String | Yes | The storage type. Valid values: BACKUP_STORAGE_FILE, BACKUP_STORAGE_OSS, BACKUP_STORAGE_COS, and BACKUP_STORAGE_S3. |
| |--storageUrl | String | Yes | The storage directory. Specify a directory without a protocol, such as /obbackup/ or osstest/backup. |
| |--ossAccessKey | Object | No | The OSS information. This parameter is valid only when backupStorageType is set to BACKUP_STORAGE_OSS. |
| |--endpoint | String | Yes | The access domain name. |
| |--accessKeyId | String | Yes | The access user. |
| |--accessKeySecret | String | Yes | The access key. |
| |--cosAccessKey | Object | No | The COS information. This parameter is valid only when backupStorageType is set to BACKUP_STORAGE_COS. |
| |--endpoint | String | Yes | The access domain name. |
| |--accessKeyId | String | Yes | The access user. |
| |--accessKeySecret | String | Yes | The access key. |
| |--appId | String | Yes | The application ID. |
| |--s3AccessKey | Object | No | The S3 information. This parameter is valid only when backupStorageType is set to BACKUP_STORAGE_S3. |
| |--endpoint | String | Yes | The access domain name. |
| |--accessKeyId | String | Yes | The access user. |
| |--accessKeySecret | String | Yes | The access key. |
| |--region | String | Yes | The region. |
| |--alarmStoragePercentageThreshold | Long | Yes | The backup storage capacity alert threshold. Specify the value in percentage. |
| storageId | Long | No | The storage configuration ID. |
| serviceType | String | No | The service type. Valid values: BACKUP_RESTORE_SERVICE (logical backup restore) and OB_CLUSTER (physical backup restore). The value of this parameter can also be OTHERS. |
| serviceId | Long | No | The service ID. |
| serviceName | String | No | The service name. |
| hostIdList | Array | No | The host ID list for global restore. |
Data structure of obSecondaryBackupConfig
Parameter |
Type |
Required |
Description |
|---|---|---|---|
| scheduleConfig | Object | Yes | The secondary backup schedule configuration. |
| |--dataBackupScheduleEnabled | Boolean | Yes | The data secondary backup switch. |
| |--logBackupScheduleEnabled | Boolean | Yes | The log secondary backup switch. |
| |--logSecondaryBackupPeriod | String | Yes | The log secondary backup schedule cycle. Valid value: ONCE_A_DAY. |
| storageConfig | Object | Yes | The storage configuration. For more information, see Data structure of obBackupServiceStorageConfig. |
Return result
Parameter |
Type |
Description |
|---|---|---|
| data | Object | The common response of backup operations. For more information, see BackupCommonResponse. |
| successful | Boolean | Indicates whether the request was successful. |
| timestamp | Datetime | The timestamp when the server finishes the request. |
| duration | Integer | The time taken by the server to process the request, in milliseconds. |
| status | Integer | An HTTP status code that conforms to the HTTP Status specification. |
| traceId | String | The trace ID of the request, which is used to troubleshoot issues. |
| server | String | The address of the application service that responds to the request. |
Data structure of BackupCommonResponse
Parameter |
Type |
Description |
|---|---|---|
| obBackupTaskType | String | The type of the backup operation. For example, "CREATE_BACKUP_STRATEGY". |
| backupObjectOpsResultList | Array | The list of backup object operation results. |
| |--obBackupObjectList | Array | The list of backup objects. |
| |--clusterId | Long | The ID of the cluster. |
| |--tenantId | Long | The ID of the tenant. |
| |--backupDimension | String | The backup dimension. Valid values: CLUSTER and TENANT. CLUSTER and TENANT indicate cluster backup and tenant backup respectively. Tenant backup is not supported at present. |
| |--beSuccessful | Boolean | Indicates whether the operation was successful. |
| |--taskIdList | Array | The list of task IDs, which is returned when asynchronous tasks are involved. |
| |--errorCode | Object | The error code. |
| |--hint | String | The hint message. |
Example
Request example
Parameter |
Type |
Required |
Description |
|---|---|---|---|
| dataBackupTimeoutMinutes | Long | Yes | The timeout period for data backup, in minutes. |
| noSuccessfulDataBackupAlarmDays | Long | Yes | The consecutive number of days exceeding which an alert for no successful backup tasks is triggered. |
| libObLogExpireDays | Long | No | The number of days for retaining liboblog. This parameter is valid only for logical backup. |
| logBackupDelaySeconds | Long | Yes | The log backup delay threshold, in seconds. |
Data structure of obBackupServiceStorageConfig
Parameter |
Type |
Required |
Description |
|---|---|---|---|
| configName | String | Yes | The name of the storage configuration. |
| obBackupStorageBaseInfo | Object | Yes | The basic parameters of the storage configuration. |
| |--backupStorageType | String | Yes | The storage type. Valid values: BACKUP_STORAGE_FILE, BACKUP_STORAGE_OSS, BACKUP_STORAGE_COS, and BACKUP_STORAGE_S3. |
| |--storageUrl | String | Yes | The storage directory. Specify a directory without any protocol name, for example, /obbackup/ or osstest/backup. |
| |--ossAccessKey | Object | No | The OSS information. This parameter is valid only when backupStorageType is set to BACKUP_STORAGE_OSS. |
| |--endpoint | String | Yes | The access domain name. |
| |--accessKeyId | String | Yes | The AccessKey ID. |
| |--accessKeySecret | String | Yes | The AccessKey secret. |
| |--cosAccessKey | Object | No | The COS information. This parameter is valid only when backupStorageType is set to BACKUP_STORAGE_COS. |
| |--endpoint | String | Yes | The access domain name. |
| |--accessKeyId | String | Yes | The AccessKey ID. |
| |--accessKeySecret | String | Yes | The AccessKey secret. |
| |--appId | String | Yes | The ID of the application. |
| |--s3AccessKey | Object | No | The S3 access key. This parameter is specified only when backupStorageType=BACKUP_STORAGE_S3. |
| |--serviceType | String | No | The backup service type. Valid values: BACKUP_RESTORE_SERVICE (indicates a backup service for logical backup and restore) and OB_CLUSTER (indicates an OceanBase cluster for physical backup and restore). |
| |--endpoint | String | Yes | The endpoint. |
| |--accessKeyId | String | Yes | The AccessKey ID. |
| |--accessKeySecret | String | Yes | The AccessKey secret. |
| |--alarmStoragePercentageThreshold | Long | Yes | The threshold for backup storage capacity alerts. Set this parameter to a percentage value. |
| storageId | Long | No | The ID of the storage configuration. |
| serviceType | String | No | The service type. Valid values: BACKUP_RESTORE_SERVICE (for logical backup recovery), OB_CLUSTER (for physical backup recovery), and OTHERS. |
| serviceId | Long | No | The ID of the service. * If the service type is BACKUP_RESTORE_SERVICE, this parameter indicates the backup and recovery service ID. * If the service type is OB_CLUSTER, this parameter indicates the cluster ID. |
| serviceName | String | No | The name of the service. * If the service type is BACKUP_RESTORE_SERVICE, this parameter indicates the name of the backup and recovery service. * If the service type is OB_CLUSTER, this parameter indicates the cluster name. |
| hostIdList | Array | No | The list of host IDs for global data recovery. * If the service type is BACKUP_RESTORE_SERVICE, this parameter indicates the list of the backup and recovery host IDs. * If the service type is OB_CLUSTER, this parameter indicates the list of host IDs in the cluster. |
Data structure of obSecondaryBackupConfig
Parameter |
Type |
Required |
Description |
|---|---|---|---|
| scheduleConfig | Object | Yes | The secondary backup scheduling configuration. |
| |--dataBackupScheduleEnabled | Boolean | Yes | Specifies whether to enable secondary data backup. |
| |--logBackupScheduleEnabled | Boolean | Yes | Specifies whether to enable secondary log backup. |
| |--logSecondaryBackupPeriod | String | Yes | The scheduling cycle for secondary log backup. Currently, only ONCE_A_DAY is supported. |
| storageConfig | Object | Yes | The storage configuration. For more information, see Data structure of obBackupServiceStorageConfig . |
Response parameters
Parameter |
Type |
Description |
|---|---|---|
| data | Object | The common response parameters for backup objects. For more information, see Data structure of BackupCommonResponse . |
| successful | Boolean | Indicates whether the request was successful. |
| timestamp | Datetime | The timestamp when the server completed the request. |
| duration | Integer | The time taken by the server to process the request, in milliseconds. |
| status | Integer | An HTTP status code. |
| traceId | String | The trace ID of the request. This trace ID is used for troubleshooting. |
| server | String | The address of the application server that responded to the request. |
Data structure of BackupCommonResponse
Parameter |
Type |
Description |
|---|---|---|
| obBackupTaskType | String | The backup operation type, for example, CREATE_BACKUP_STRATEGY. |
| backupObjectOpsResultList | Array | The operation result set of the backup object. |
| |--obBackupObjectList | Array | The list of information returned for the backup object. |
| |--clusterId | Long | The ID of the cluster. |
| |--tenantId | Long | The ID of the tenant. |
| |--backupDimension | String | The backup dimension. Valid values: * CLUSTER * TENANT CLUSTER represents cluster backup and TENANT represents tenant backup. Tenant backup is not supported. |
| |--beSuccessful | Boolean | Indicates whether the operation was successful. |
| |--taskIdList | Array | The list of task numbers returned for asynchronous tasks. |
| |--errorCode | Object | The error code. |
| |--hint | String | The prompt information. |
Examples
Sample request
{
"backupMode": "PHYSICAL_BACKUP",
"obSecondaryBackupConfig": {
"storageConfig": {
"configName": "nfs0907_1451",
"obBackupStorageBaseInfo": {
"backupStorageType": "BACKUP_STORAGE_FILE",
"storageUrl": "/obbackup/backup_backup"
},
"alarmStoragePercentageThreshold": 80,
"storageId": 2000035
},
"scheduleConfig": {
"logSecondaryBackupPeriod": "ONCE_AN_HOUR",
"logBackupScheduleEnabled": true,
"dataBackupScheduleEnabled":true
}
},
"obBackupThresholdConfig": {
"dataBackupTimeoutMinutes": 7,
"logBackupDelaySeconds": 300,
"noSuccessfulDataBackupAlarmDays": 2
},
"secondaryBackupEnabled": true,
"obBackupObjectList": [
{
"clusterId": 1000005,
"backupDimension": "CLUSTER"
}
],
"obBackupScheduleConfig": {
"dayAndDataBackupModelMap": {
"2": "FULL_BACKUP",
"4": "FULL_BACKUP",
"6": "FULL_BACKUP"
},
"startLogBackup": true,
"backupScheduleMode": "WEEK",
"backupScheduleTime": "15:18:00.000+08:00"
},
"obBackupServiceStorageConfig": {
"configName": "nfs0907_1452",
"obBackupStorageBaseInfo": {
"backupStorageType": "BACKUP_STORAGE_FILE",
"storageUrl": "/obbackup/"
},
"storageId": 2000034,
"alarmStoragePercentageThreshold": 80
}
}
Response example
{
"data": {
"backupObjectOpsResultList": [
{
"beSuccessful": true,
"obBackupObjectList": [
{
"backupDimension": "CLUSTER",
"clusterId": 1000005
}
],
"taskIdList": []
}
],
"obBackupTaskType": "UPDATE_BACKUP_STRATEGY"
},
"duration": 110,
"server": "a83ad33525",
"status": 200,
"successful": true,
"timestamp": "2021-09-07T15:16:14.651+08:00",
"traceId": "042fbebcb14742e9"
}
