Modify the backup strategy of a tenant

2025-01-10 06:05:58  Updated

Description

You can call this operation to modify the backup strategy of a tenant.

Call description

Prerequisites

You have passed the authentication for the OceanBase Cloud Platform (OCP) application service.

Request path

PATCH /api/v2/ob/clusters/{id}/tenants/{tenantId}/backup/config/backupStrategy

Request parameters

Path parameters

Parameter Type Required Example value Description
id Integer Yes 1002 The ID of the cluster.
tenantId Integer Yes 108 The ID of the tenant.

Body parameters

Parameter Type Required Example value Description
backupMode String Yes LOGICAL_BACKUP The backup mode. Valid values:
  • LOGICAL_BACKUP: indicates logical backup.
  • PHYSICAL_BACKUP: indicates physical backup.
  • obBackupScheduleConfig Obbackupscheduleconfig Yes NA The backup scheduling configuration. For more information, see Data structure of obBackupScheduleConfig.
    obBackupThresholdConfig Obbackupthresholdconfig Yes NA The backup alert threshold configuration. For more information, see Data structure of obBackupThresholdConfig.
    obBackupServiceStorageConfig Obbackupservicestorageconfig Yes NA The backup storage configuration. For more information, see Data structure of obBackupServiceStorageConfig.

    Data structure of obBackupScheduleConfig

    Parameter Type Required Description
    backupScheduleMode String Yes The backup scheduling cycle. Valid values:
  • WEEK: indicates that backup is scheduled on a weekly basis.
  • MONTH: indicates that backup is scheduled on a monthly basis.
  • backupScheduleEnabled Boolean No The backup switch.
    backupScheduleTime OffsetTime Yes The scheduled backup time, for example, "02:00:00.000+08:00".
    dayAndDataBackupModelMap Map Yes The backup schedule and data backup method. For example, { "2": "FULL_BACKUP", "4": "FULL_BACKUP", "6": "INCREMENTAL_BACKUP" } specifies to perform full data backup on Tuesday and Thursday and perform incremental data backup on Saturday.
    startLogBackup Boolean Yes Specifies whether to start log backup at the same time. This parameter is usually set to true.
    cleanEnabled Boolean No Specifies whether to delete expired data.
    backupDataRetentionDays Long No The retention period of backup data, in days. For example, the value 7 specifies to retain the backup data for at least seven days. This parameter takes effect only when cleanEnabled is set to true.
    cleanScheduleTime OffsetTime No The scheduled time to delete expired data.

    Data structure of obBackupThresholdConfig

    Parameter Type Required Description
    dataBackupTimeoutMinutes Long Yes The timeout period for data backup, in minutes.
    noSuccessfulDataBackupAlarmDays Long Yes The number of consecutive days exceeding which an alert for no successful backups is triggered.
    libObLogExpireDays Long No The retention days of liboblog data. This parameter is valid only for logical backup.
    logBackupDelaySeconds Long Yes The threshold for log backup delay alerts, 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 information about Alibaba Cloud Object Storage Service (OSS). This parameter is valid only when backupStorageType is set to BACKUP_STORAGE_OSS.
    |--endpoint String Yes The domain name for access.
    |--accessKeyId String Yes The AccessKey ID.
    |--accessKeySecret String Yes The AccessKey secret.
    |--cosAccessKey Object No The information about Tencent Cloud Object Storage (COS). This parameter is valid only when backupStorageType is set to BACKUP_STORAGE_COS.
    |--endpoint String Yes The domain name for access.
    |--accessKeyId String Yes The AccessKey ID.
    |--accessKeySecret String Yes The AccessKey secret.
    |--appId String Yes The application ID.
    |--s3AccessKey Object No The information about Amazon Simple Storage Service (S3). This parameter is valid only when backupStorageType is set to BACKUP_STORAGE_S3.
    |--endpoint String Yes The domain name for access.
    |--accessKeyId String Yes The AccessKey ID.
    |--accessKeySecret String Yes The AccessKey secret.
    |--region String Yes The region.
    |--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: indicates the backup and restore service (logical backup and restore).
  • OB_CLUSTER: indicates physical backup and restore for OceanBase clusters.
  • OTHERS: indicates other services.
  • serviceId Long No The service ID.
  • When the service type is BACKUP_RESTORE_SERVICE, the value is the ID of the backup and restore service.
  • When the service type is OB_CLUSTER, the value is a cluster ID.
  • serviceName String No The service name.
  • When the service type is BACKUP_RESTORE_SERVICE, the value is the name of the backup and restore service.
  • When the service type is OB_CLUSTER, the value is a cluster name.
  • hostIdList Array No The list of host IDs for host resolution in global restore.
  • When the service type is BACKUP_RESTORE_SERVICE, the value is a list of host IDs of the backup and restore service.
  • When the service type is OB_CLUSTER, the value is a list of IDs of hosts in a cluster.
  • Response parameters

    Basic data structure

    Parameter Type Description
    data Object 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 amount of time taken by the server to process the request, in milliseconds.
    status Integer The 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 type of the backup operation, for example, "CREATE_BACKUP_STRATEGY".
    backupObjectOpsResultList Array The operation result set of the backup object.
    |--obBackupObjectList Array The list of backup objects.
    |--clusterId Long The cluster ID.
    |--tenantId Long The tenant ID.
    |--backupDimension String The backup dimension. For example, CLUSTER indicates cluster backup and TENANT indicates tenant backup.
    |--beSuccessful Boolean Indicates whether the operation was successful.
    |--taskIdList Array The list of task IDs, which is returned only for asynchronous tasks.
    |--errorCode Object The error code.
    |--hint String The prompt information.

    Examples

    Sample request

    PATCH /api/v2/ob/clusters/1000005/tenants/1000012/backup/config/backupStrategy

    {
        "backupMode": "PHYSICAL_BACKUP",
        "obBackupThresholdConfig": {
            "dataBackupTimeoutMinutes": 7,
            "logBackupDelaySeconds": 300,
            "noSuccessfulDataBackupAlarmDays": 2
        },
        "obBackupObjectList": [
            {
                "clusterId": 1000005,
                "tenantId": 1000012,
                "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": 26,
            "alarmStoragePercentageThreshold": 80
        }
    }
    

    Sample response

    {
      "data": {
        "backupObjectOpsResultList": [
          {
            "beSuccessful": true,
            "obBackupObjectList": [
              {
                "backupDimension": "TENANT",
                "clusterId": 1000005,
                "tenantId": 1000012
              }
            ],
            "taskIdList": []
          }
        ],
        "obBackupTaskType": "UPDATE_BACKUP_STRATEGY"
      },
      "duration": 237,
      "server": "74f95ea2f4",
      "status": 200,
      "successful": true,
      "timestamp": "2024-08-09T11:27:28.912+08:00",
      "traceId": "456cdd98f556103d"
    }
    

    Contact Us