You need to enable JavaScript to run this app.
导航
CreateBackup
最近更新时间:2024.11.05 16:00:06首次发布时间:2023.02.02 17:41:21

调用 CreateBackup 接口创建备份。

请求类型

异步请求。

调试

请求参数

参数
类型
是否必选
示例值
描述
InstanceId
String
mysql-e26822cf****
实例 ID。
BackupMethod
String
Physical

备份类型,取值:

  • Physical:物理备份。默认值。
  • Logical:逻辑备份。
BackupType
String
Full

备份方式。

  • 取值范围:
    • Full,物理备份类型下的全量备份。默认值。
    • DumpAll:逻辑备份类型下的全库备份。
  • 前提条件:
    • 如需创建逻辑备份类型的全库备份,即 BackupType 取值为 DumpAll时,备份类型应设置为逻辑备份,即 BackupMethod 取值应为 Logical
    • 如需创建逻辑备份类型的库表备份,则不需传入该字段,只需在 BackupMeta 字段指定需备份的库和表。
BackupMeta
Object[]
请参见请求示例。

创建逻辑备份类型的库表备份时,用于指定要备份的库表信息。

  • 前提条件:BackupMethod 取值为 Logical,且不传 BackupType 字段。
  • 互斥情况:BackupType 字段取值为 DumpAll 时,该字段不生效。
  • 数量限制:创建指定库表备份时,库的数量上限为 5000,每个库的表的数量上限为 5000。

返回参数

参数
类型
示例值
描述
BackupId
String
2c587b3e5b6e409ca38a2c99462a****
新创建的备份的 ID。

示例

请求示例 1

创建备份方式为全量备份的物理备份

POST /?Action=CreateBackup&Version=2022-01-01 HTTP/1.1
Accept: application/json
Content-Type: application/json
Host: rds.volcengineapi.com
X-Date: 20211202T101010Z
Authorization: HMAC-SHA256 Credential=AKLTN2I0MmFiNzMxNWE5NDgzMzk4MmVjMTVkODlkZTZ****/20211202/cn-beijing/rds_mysql/request,SignedHeaders=x-date, Signature=71d31fc7bcf990142851c9833c5656391486cda0ae2e0b8ada733b7c6458****
{
    "InstanceId": "mysql-ce48081d****",
    "BackupType": "Full",
    "BackupMethod": "Physical"
}

返回示例 1

{
    "ResponseMetadata": {
        "RequestId": "20230111114312146C48B77B8FB071C1FD",
        "Action": "CreateBackup",
        "Version": "2022-01-01",
        "Service": "rds_mysql",
        "Region": "cn-beijing"
    },
    "Result": {
        "BackupId": "986533aae3ac4e27af6ec1cd2aeeca1d"
    }
}

请求示例 2

创建备份方式为全库备份的逻辑备份

POST /?Action=CreateBackup&Version=2022-01-01 HTTP/1.1
Accept: application/json
Content-Type: application/json
Host: rds.volcengineapi.com
X-Date: 20211202T101010Z
Authorization: HMAC-SHA256 Credential=AKLTN2I0MmFiNzMxNWE5NDgzMzk4MmVjMTVkODlkZTZ****/20211202/cn-beijing/rds_mysql/request,SignedHeaders=x-date, Signature=71d31fc7bcf990142851c9833c5656391486cda0ae2e0b8ada733b7c6458****
{
    "InstanceId": "mysql-ce48081d****",
    "BackupMethod":"Logical",
    "BackupType":"DumpAll"
}

返回示例 2

{
    "ResponseMetadata": {
        "RequestId": "20230111114312146C48B77B8FB071C1FD",
        "Action": "CreateBackup",
        "Version": "2022-01-01",
        "Service": "rds_mysql",
        "Region": "cn-beijing"
    },
    "Result": {
        "BackupId": "2c587b3e5b6e409ca38a2c99462a****"
    }
}

请求示例 3

创建备份方式为库表备份的逻辑备份

POST /?Action=CreateBackup&Version=2022-01-01 HTTP/1.1
Accept: application/json
Content-Type: application/json
Host: rds.volcengineapi.com
X-Date: 20211202T101010Z
Authorization: HMAC-SHA256 Credential=AKLTN2I0MmFiNzMxNWE5NDgzMzk4MmVjMTVkODlkZTZ****/20211202/cn-beijing/rds_mysql/request,SignedHeaders=x-date, Signature=71d31fc7bcf990142851c9833c5656391486cda0ae2e0b8ada733b7c6458****
{
    "InstanceId": "mysql-ce48081d****",
    "BackupMethod": "Logical",
    "BackupMeta": [
        {
            "DBName": "testdb",
            "Tables": [
                ""
            ]
        }
    ]
}

返回示例 3

{
    "ResponseMetadata": {
        "RequestId": "20230111114312146C48B77B8FB071C1FD",
        "Action": "CreateBackup",
        "Version": "2022-01-01",
        "Service": "rds_mysql",
        "Region": "cn-beijing"
    },
    "Result": {
        "BackupId": "e2a7f1ea55fb43b281b5fcaf3f5e****"
    }
}

错误码

更多详情,请参见错误码