Overview
You can call this API to modify a backup strategy.
API details
Constraints
The caller must have an AccessKey for accessing the multi-cloud API. For information about how to obtain the AccessKey ID and AccessKey secret, see Manage AccessKeys.
Request path
POST /api/v2/instances/{instanceId}/backup/strategy
Request parameters
Path
| Parameter | Type | Required | Description |
|---|---|---|---|
| instanceId | String | Yes | The ID of the instance. |
Query
| Parameter | Type | Required | Description |
|---|---|---|---|
| action | String | Yes | ModifyBackupStrategy |
| requestId | String | Yes | The unique identifier of the request. |
Body
| Parameter | Type | Required | Description | Example value |
|---|---|---|---|---|
| instanceId | String | Yes | The ID of the instance. | obxxx |
| backupschedulemode | String | Yes | The backup schedule mode. Valid values:
|
WEEK |
| scheduleTime | String | Yes | The specific time at which the backup is executed in UTC time. | 20:00:00Z |
| timeList | List |
Yes | The list of backup execution times. The meaning of this parameter depends on the value of backupScheduleMode.
|
[1, 3, 5] |
| lastDayOfMonth | Boolean | No | Specifies whether to execute the backup on the last day of the month. This parameter takes effect only when the backup schedule mode is set to MONTH. If you set this parameter to true, the backup is executed on the last day of the month regardless of the number of days in the month. Default value: false. |
false |
| dataMaintainDays | Integer | Yes | The number of days for which local backup data is retained. We recommend that you set this parameter to a value between 1 and 365. | 7 |
| retainMode | String | Yes | The backup retention mode, which defines the backup retention strategy. Valid values:
|
TIME |
| backupStorageConfig | string | Yes | The backup storage configuration. This parameter is a JSON string. | - |
| -backupStorageType | String | Yes | The backup storage type. | COS |
| crossRegionFlag | Boolean | No | Specifies whether to enable cross-region backup. Default value: false. |
false |
| isCrossBorder | Boolean | No | Specifies whether the cross-region backup is cross-border. Default value: false. |
false |
| remoteBackupRegion | String | No | The region where the cross-region backup is executed. Default value: empty. | cn-hangzhou |
| remoteBackupStrategy | object | No | The detailed configuration of the cross-region backup strategy. | - |
| -backupScheduleMode | String | Yes | The cross-region backup schedule mode. Valid values:
|
WEEK |
| -timeList | List |
Yes | The list of cross-region backup execution times. The value of this parameter is similar to that of the timeList parameter in the main backup strategy, but the value of this parameter is a list of strings. |
[1, 3, 5] |
| -backupTimesInMonth | String | Yes | The number of cross-region backups executed each month. Valid values: FIRST, SECOND, THIRD, FOURTH, and LAST. | FIRST |
| -dataMaintainDays | Integer | Yes | The number of days for which cross-region backup data is retained. Valid values: 7 to 720. | 7 |
| archiveFlag | Boolean | No | Specifies whether to enable archive backup. Default value: false. |
false |
| archiveBackupStrategy | object | No | The detailed configuration of the archive backup strategy. | - |
| -backupScheduleMode | String | Yes | The archive backup schedule mode. Valid values:
|
WEEK |
| -timeList | List |
Yes | The list of archive backup execution times. The value of this parameter is similar to that of the timeList parameter in the main backup strategy, but the value of this parameter is a list of strings. |
[1, 3, 5] |
| -backupTimesInMonth | String | Yes | The number of archive backups executed each month. Valid values: FIRST, SECOND, THIRD, FOURTH, and LAST. | FIRST |
| -dataMaintainDays | Integer | Yes | The number of days for which archive backup data is retained. | 7 |
| archiveBackupCleanMode | String | No | The archive backup cleanup mode. Default value: DELETE.
|
DELETE |
| sparseBackupFlag | Boolean | No | Specifies whether to enable sparse backup. Default value: false. |
false |
| sparseBackupStrategies | object | No | The list of sparse backup strategies. You can configure different retention rules for different sparse backup strategies. | - |
| - backupMaintainMatchRule | object | Yes | The backup match rule, which specifies which backups match the retention strategy. | - |
| -- backupScheduleMode | String | Yes | The match schedule mode. Valid values:
|
WEEK |
| -- weeks | List |
Yes | The list of days of the week on which the backup is executed. Valid values: 1 to 7. 1 indicates Monday. This parameter is used only when the backup schedule mode is set to WEEK. |
[1, 7] |
| -- days | List |
Yes | The list of days of the month or year on which the backup is executed. Valid values: 1 to 31. This parameter is used only when the backup schedule mode is set to MONTH or YEAR. |
[1, 15] |
| -- month | String | Yes | The month on which the backup is executed. Valid values: 1 to 12. This parameter is used only when the backup schedule mode is set to YEAR. |
12 |
| - backupMaintainStrategy | object | Yes | The backup retention strategy, which specifies how to retain backups that match the match rule. | - |
| -- backupMaintainMode | String | Yes | The backup retention mode. Valid values:
|
PERMANENT |
| -- maintainDay | String | Yes | The retention period in days. This parameter takes effect only when the value of backupMaintainMode is TEMPORARY. |
7 |
| -- reserveLogBackup | String | Yes | Specifies whether to retain the corresponding log backup. Default value: false. |
false |
Response parameters
| Parameter | Type | Description | Example value |
|---|---|---|---|
| data | Object | The response is empty. | null |
Examples
Request example
curl --digest -u 'ak:sk' \
-X POST \
'https://api-cloud.oceanbase.com/api/v2/instances/{instanceId}/backup/strategy' \
-H "Content-Type: application/json" \
-d '{
"backupScheduleMode": "WEEK",
"scheduleTime": "02:00:00",
"timeList": [1, 3, 5],
"dataMaintainDays": 7
}'
The following examples show some of the commonly used backup strategies.
Scenario 1: You enable weekly incremental backup. The backup runs at 2:00 AM every Monday, Wednesday, and Friday and is retained for 7 days.
{
"backupScheduleMode": "WEEK",
"scheduleTime": "02:00:00",
"timeList": [1, 3, 5],
"dataMaintainDays": 7
}
Scenario 2: Enable cross-region backup and perform a backup every Sunday. Then, retain the backups from the first Sunday of every month in the Shanghai region for 30 days.
{
"backupScheduleMode": "WEEK",
"scheduleTime": "02:00:00",
"timeList": [7],
"dataMaintainDays": 7,
"crossRegionFlag": true,
"isCrossBorder": false,
"remoteBackupRegion": "cn-shanghai",
"remoteBackupStrategy": {
"backupScheduleMode": "week",
"timeList": ["7"],
"backupTimesInMonth": "FIRST",
"dataMaintainDays": 30
}
}
Scene 3: Archival backup is enabled. Backups are performed every Sunday. Backup archives created on January 1st of each month are retained for 365 days. Archived data will remain in the archive storage and be retained for 365 days when the backup strategy is stopped.
{
"backupScheduleMode": "WEEK",
"scheduleTime": "02:00:00",
"timeList": [7],
"dataMaintainDays": 7,
"archiveFlag": true,
"archiveBackupStrategy": {
"backupScheduleMode": "month",
"timeList": [1],
"dataMaintainDays": 365
},
"archiveBackupCleanMode": "RESERVE"
}
Scenario 4: A backup strategy for which only incremental backup is configured
- Backups are executed every day, and the default retention period is 7 days.
- Backups are retained for 30 days every Sunday.
- Backups created on the 1st of each month are retained for 365 days.
- Backups retained for a long period also retain logs.
{
"backupScheduleMode": "WEEK",
"scheduleTime": "02:00:00",
"timeList": [1, 2, 3, 4, 5, 6, 7],
"dataMaintainDays": 7,
"sparseBackupFlag": true,
"sparseBackupStrategies": [
{
"backupMaintainMatchRule": {
"backupScheduleMode": "WEEK",
"weeks": [7]
},
"backupMaintainStrategy": {
"backupMaintainMode": "TEMPORARY",
"maintainDay": 30,
"reserveLogBackup": true
}
},
{
"backupMaintainMatchRule": {
"backupScheduleMode": "MONTH",
"days": [1]
},
"backupMaintainStrategy": {
"backupMaintainMode": "TEMPORARY",
"maintainDay": 365,
"reserveLogBackup": true
}
}
]
}
Response example
JSON format
{
"data":{},
"requestId":"275168e0-4c98-4e30-9b1e-64393e79ee73",
"success":true
}