Restoring Data to a New DB Instance

Function

This API is used to restore data to a new DB instance.

Constraints

Currently, Microsoft SQL Server is not supported.

URI

  • URI format

    PATH: /rds/v1/{project_id}/instances

    Method: POST

  • Parameter description

    Table 1 Parameter description

    Name

    Mandatory

    Description

    project_id

    Yes

    Specifies the project ID of a tenant in a region.

Request

  • Parameter description

    Table 2 Parameter description

    Name

    Type

    Description

    instance

    Dictionary data structure. For details, see Table 3.

    Specifies new DB instance details.

    Table 3 instance field data structure description

    Name

    Mandatory

    Type

    Description

    name

    Yes

    String

    Specifies the DB instance name.

    DB instances of the same type can have same names under the same tenant.

    Valid value:

    The value must be 4 to 64 characters in length and start with a letter. It is case-insensitive and can contain only letters, digits, hyphens (-), and underscores (_).

    flavorRef

    Yes

    String

    Specifies the specification ID (flavors.id in the response message in section Obtaining All DB Instance Specifications).

    Valid value:

    The value cannot be empty. The string length and whether the string complying with UUID regular expression rules are verified.

    volume

    Yes

    Dictionary data structure. For details, see Table 4.

    Specifies the volume information.

    This parameter is mandatory for the creation of a single or primary/standby DB instances.

    ha

    No

    Dictionary data structure. For details, see Table 5.

    Specifies the HA configuration parameter. It is mandatory for the primary/standby DB instance creation.

    restorePoint

    Yes

    Dictionary data structure. For details, see Table 6.

    Specifies the configuration parameter for restoring data to a new DB instance.

    Table 4 volume field data structure description

    Name

    Mandatory

    Type

    Description

    size

    Yes

    Int

    Specifies the volume size.

    Its value range is from 40 GB to 4000 GB. The value must be a multiple of 10.

    Important

    NOTICE: The volume size of the new DB instance must be greater than or equal to that of the original DB instance.

    Table 5 ha field data structure description

    Name

    Mandatory

    Type

    Description

    enable

    Yes

    Boolean

    Specifies the HA configuration parameter.

    Valid value:

    The value is true or false. The value true indicates creating primary/standby DB instances. The value false indicates creating a single DB instance.

    replicationMode

    Yes

    String

    Specifies the replication mode for the standby DB instance.

    The value cannot be empty.

    • For MySQL, the value is async or semisync.

    • For PostgreSQL, the value is async or sync.

    Note

    • async indicates the asynchronous replication mode.

    • semisync indicates the semi-synchronous replication mode.

    • sync indicates the synchronous replication mode.

    Table 6 restorePoint field data structure description

    Name

    Mandatory

    Type

    Description

    backupRef

    No

    String

    Specifies the full backup file.

    restoreTime

    No

    Long

    Specifies the time point the DB instance is restored to. At least one of the backupRef and restoreTime parameters should be specified. If both parameters are specified, the DB instance is restored using the full backup file.

    sourceInstanceId

    No

    String

    Specifies the source DB instance ID.

    If backupRef is not specified and restoreTime is specified, the sourceInstanceId parameter is mandatory.

  • Request example

    {
        "instance": {
            "name": "trove-newinstance",
            "flavorRef": "bf07a6d4-844a-4023-a776-fc5c5fb71fb4",
            "volume": {
                "size": 100
            },
            "restorePoint":{
               "backupRef": "2f4ddb93-b901-4b08-93d8-1d2e472f30fe",
               "sourceInstanceId": "0bc7300c-dc63-45d4-aa3b-d85bf577baac"
            }
        }
    }
    

Normal Response

  • Parameter description

    Table 7 Parameter description

    Name

    Type

    Description

    instance

    Dictionary data structure. For details, see Table 8.

    Indicates the DB instance information.

    Table 8 instance field data structure description

    Name

    Type

    Description

    id

    String

    Indicates the primary node ID of the DB instance.

    Note

    This field is not the DB instance ID. You are advised to use API v3 and the DB instance ID to perform related operations.

    status

    String

    Indicates the DB instance status. The value is BUILD.

    name

    String

    Indicates the provisioned DB instance information.

    created

    String

    Indicates the creation time. It is a blank string.

    hostname

    String

    Indicates the DB instance connection address. It is a blank string.

    type

    String

    Indicates the DB instance type.

    region

    String

    Indicates the region ID.

    updated

    String

    Indicates the empty string.

    availabilityZone

    String

    Indicates the AZ ID, which is the same as that of the specified DB instance.

    vpc

    String

    Indicates the VPC ID, which is the same as that of the specified DB instance.

    nics

    Dictionary data structure. For details, see Table 9.

    Indicates the nics information, which is the same as that of the specified DB instance.

    securityGroup

    Dictionary data structure. For details, see Table 10.

    Indicates the security group that the specified DB instance belongs to.

    flavor

    Dictionary data structure. For details, see Table 11.

    Indicates the specification ID, which is the same as that of the specified DB instance.

    volume

    Dictionary data structure. For details, see Table 12.

    Indicates the volume information.

    dataStoreInfo

    List data structure

    Its value is null.

    dbPort

    Integer

    Indicates the database port number.

    extendparam

    Dictionary data structure. For details, see Table 13.

    Indicates the returned extendparam key-value pair.

    backupStrategy

    Dictionary data structure. For details, see Table 15.

    Indicates the backup policy information, which is the same as that of the specified DB instance.

    Table 9 nics field data structure description

    Name

    Type

    Description

    subnetId

    String

    Indicates the network ID of the subnet.

    Table 10 securityGroup field data structure description

    Name

    Type

    Description

    id

    String

    Indicates the security group ID.

    Table 11 flavor field data structure description

    Name

    Type

    Description

    id

    String

    Indicates the specification ID.

    Table 12 volume field data structure description

    Name

    Type

    Description

    type

    String

    Indicates the volume type.

    size

    Int

    Indicates the volume size.

    Table 13 extendparam field data structure description

    Name

    Type

    Description

    jobs

    List data structure. For details, see Table 14.

    Indicates the returned jobs parameter information.

    Table 14 jobs field data structure description

    Name

    Type

    Description

    id

    String

    Indicates the task ID.

    Table 15 backupStrategy field data structure description

    Name

    Type

    Description

    startTime

    String

    Indicates the backup start time that has been set. The backup task will be triggered within one hour after the backup start time.

    The time is in the UTC format.

    keepDays

    Int

    Indicates the number of days to retain the generated backup files.

    The value range is from 0 to 732. If this parameter is 0, the automated backup policy is not set. To extend the retention period, contact customer service. Automated backups can be retained for up to 2562 days.

  • Response example

    {
        "instance": {
            "id": "9fbe7995-9851-47ea-b7af-6037104a1dd5",
            "status": "BUILD",
            "name": "rds-f1d61",
            "created": "",
            "hostname": "",
            "type": "master",
            "region": "eu-de",
            "updated": "",
            "availabilityZone": "eu-de-01",
            "vpc": "2d6d6053-6dd1-46d7-99b4-02c62686a628",
            "nics": {
                "subnetId": "a2c3a6e3-5204-4f53-aa4c-bc3d22c98176"
            },
            "securityGroup": {
                "id": "8c3f8730-f63b-48d4-a183-d0c8a091db8c"
            },
            "flavor": {
                "id": "0d922098-553c-4124-80df-e627a1d41a0d"
            },
            "volume": {
                "type": "ULTRAHIGH",
                "size": 100
            },
            "dataStoreInfo": null,
            "dbPort": 3306,
            "extendparam": {
                "jobs": [
                    {
                        "id": "ff80808156fd9aee0156fe1fef4a294f"
                    }
                ]
            },
            "backupStrategy": {
                "startTime": "22:00:00",
                "keepDays": 2
            }
        }
    }
    

Abnormal Response

For details, see Abnormal Request Results.