文档数据库服务
| Details
  • 查询API版本
    • ListApiVersion
    • ShowApiVersion
  • 引擎版本和规格
    • ListDatastoreVersions
    • ListFlavorInfos
    • ListFlavors
    • ListStorageType
  • 实例管理
    • AddReadonlyNode
    • AddShardingNode
    • AttachEip
    • AttachInternalIp
    • BatchUpgradeDatabaseVersion
    • CancelEip
    • ChangeOpsWindow
    • CheckWeakPassword
    • CreateInstance
    • CreateIp
    • DeleteInstance
    • DeleteLtsConfig
    • DeleteReadonlyNode
    • ExpandReplicasetNode
    • ListAz2Migrate
    • ListInstances
    • ListLtsConfigs
    • ListRecycleInstances
    • ListSslCertDownloadAddress
    • MigrateAz
    • ResizeInstance
    • ResizeInstanceVolume
    • RestartInstance
    • SetAutoEnlargePolicies
    • SetRecyclePolicy
    • ShowAutoEnlargePolicy
    • ShowClientNetwork
    • ShowDiskUsage
    • ShowRecyclePolicy
    • ShowReplSetName
    • ShowSecondLevelMonitoringStatus
    • ShowUpgradeDuration
    • ShrinkInstanceNodes
    • SwitchoverReplicaSet
    • SwitchSecondLevelMonitoring
    • SwitchSsl
    • UpdateClientNetwork
    • UpdateInstanceName
    • UpdateInstancePort
    • UpdateInstanceRemark
    • UpdateLtsConfig
    • UpdateReplSetName
    • UpdateSecurityGroup
    • UpgradeDatabaseVersion
  • 连接管理
    • DeleteSession
    • ListSessions
    • ShowConnectionStatistics
  • 备份与恢复
    • BatchDeleteBackup
    • CreateManualBackup
    • DeleteManualBackup
    • ListBackups
    • ListRestoreCollections
    • ListRestoreDatabases
    • ListRestoreTimes
    • RestoreInstance
    • RestoreInstanceFromCollection
    • RestoreNewInstance
    • SetBackupPolicy
    • ShowBackupDownloadLink
    • ShowBackupPolicy
    • StopBackup
  • 获取日志信息
    • DeleteAuditLog
    • DownloadErrorlog
    • DownloadSlowlog
    • ListAuditlogLinks
    • ListAuditlogs
    • ListErrorLogs
    • ListLtsErrorLogs
    • ListLtsSlowLogs
    • ListSlowLogs
    • SetAuditlogPolicy
    • ShowAuditlogPolicy
    • ShowSlowlogDesensitizationSwitch
    • SwitchSlowlogDesensitization
  • 标签管理
    • BatchTagAction
    • ListInstancesByTags
    • ListInstanceTags
    • ListProjectTags
  • 管理数据库和用户
    • CheckPassword
    • CreateDatabaseRole
    • CreateDatabaseUser
    • DeleteDatabaseRole
    • DeleteDatabaseUser
    • ListDatabaseRoles
    • ListDatabases
    • ListDatabaseUsers
    • ResetPassword
    • SetBalancerSwitch
    • SetBalancerWindow
    • ShowShardingBalancer
  • 参数配置
    • CompareConfiguration
    • CopyConfiguration
    • CreateConfiguration
    • DeleteConfiguration
    • ListAppliedInstances
    • ListConfigurations
    • ResetConfiguration
    • ShowConfigurationAppliedHistory
    • ShowConfigurationModifyHistory
    • ShowConfigurationParameter
    • ShowEntityConfiguration
    • ShowInstanceConfigurationModifyHistory
    • SwitchConfiguration
    • UpdateConfigurationParameter
    • UpdateEntityConfiguration
    • ValidateConfigurationName
  • 配额管理
    • ShowQuotas
  • 任务管理
    • ListTasks
    • ShowJobDetail
  • 数据库运维
    • CreateKillOpRule
    • DeleteKillOpRuleList
    • ShowKillOpRuleRuleList
    • SwitchInstancePrimary
    • UpdateKillOpRule
  • 定时任务
    • CancelScheduledTask
    • ListScheduledTasks

RestoreNewInstance

POST
https://dds.af-south-1.myhuaweicloud.com/v3/{project_id}/instances
Advanced
Required parameters only
Default
Encrypt sensitive parameters
*
Region
Headers
*
Authorization
Parameters
*
project_id
Body
*{
*
name
:
*
availability_zone
:
*
vpc_id
:
*
subnet_id
:
*
security_group_id
:
*
password
:
*
disk_encryption_id
:
*
flavor
: [
* {
*
type
:
*
num
:
*
size
:
*
spec_code
:
*}
+Add
*]
*
backup_strategy
: {
*
start_time
:
*
keep_days
:
*}
*
enterprise_project_id
:
*
ssl_option
:
*
dss_pool_id
:
*
server_group_policies
: [
+Add
*]
*
restore_point
: {
*
instance_id
:
*
type
:
*
backup_id
:
*
restore_time
:
*}
}
API Description

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

Constraints
  • The new DB instance must be a pay-per-use DB instance.
  • The database type of the destination DB instance must be the same as that of the source DB instance.
  • Currently, only replica set instances and cluster instances 4.0 can be restored to a new instance and to any point in time.
URL
POST  https://dds.af-south-1.myhuaweicloud.com/v3/{project_id}/instances
Request Parameters
NameTypeINMandatoryDescription
x-auth-token
stringheader Yes

Specifies the user token obtained from the IAM service.

project_id
stringpath Yes

Specifies the project ID of a tenant in a region.

Body Parameters
NameTypeMandatoryDescription
name
string Yes

Specifies the DB instance name. The DB instance name of the same DB engine is unique for the same tenant. The value must be 4 to 64 characters in length and start with a letter (from A to Z or from a to z). It is case-sensitive and can contain only letters, digits (from 0 to 9), hyphens (-), and underscores (_).

availability_zone
string Yes

Specifies the AZ ID.

vpc_id
string Yes

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

subnet_id
string Yes

Specifies the subnet ID.

security_group_id
string Yes

Specifies the ID of the security group where a specified DB instance belongs to.

password
string No

Specifies the database password. The value must be 8 to 32 characters in length and contain uppercase letters (A to Z), lowercase letters (a to z), digits (0 to 9), and special characters, such as ~!@#%^*-_=+? Enter a strong password to improve security, preventing security risks such as brute force cracking. If this parameter is not transferred, set a password for the instance before connecting to the instance.

disk_encryption_id
string No

Specifies the key ID used for disk encryption. The string must comply with UUID regular expression rules. If this parameter is not transferred, disk encryption is not performed.

flavor
Array of RestoreNewInstanceFlavorOption objects Yes

Specifies the instance specifications.

backup_strategy
BackupStrategy object No

Specifies the advanced backup policy.

enterprise_project_id
string No

Specifies the enterprise project ID.

ssl_option
string No

Specifies whether to enable or disable SSL. Valid value:

  • The value 0 indicates that SSL is disabled by default.
  • The value 1 indicates that SSL is enabled by default.
  • If this parameter is not transferred, SSL is enabled by default.
dss_pool_id
string No

Specifies the DSS storage pool ID of the DeC user. The value is left blank by default. Only DeC users can set this parameter.

server_group_policies
Array of strings No

Specifies the names of the policies associated with the ECS group of the DeC user. Available values include:

  • anti-affinity indicates that anti-affinity deployment is enabled for the DDS instance. To ensure high availability, the primary, secondary, and hidden nodes are created on different physical machines.
  • If this parameter is not transferred for DeC users, anti-affinity deployment is disabled by default. Only DeC users can set this parameter.
restore_point
RestorePoint object Yes

Specifies the details about the backup to be restored to a new DB instance.

Parameter:
flavor
NameTypeMandatoryDescription
type
string Yes

Specifies the node type. Valid value:

  • For a cluster instance, the value can be mongos, shard, or config.
  • For a replica set instance, the value is replica.
  • For a single node instance, the value is single.
num
string Yes

Specifies node quantity. Valid value:

  • In a cluster instance, the number of mongos nodes ranges from 2 to 32.
  • In a cluster instance, the number of shard nodes ranges from 2 to 32.
  • shard: The value ranges from 2 to 32.
  • config: The value is 1.
  • replica: The number of nodes can be 3, 5, or 7.
  • single: The value is 1.
size
string No

Specifies the disk size. The value must be a multiple of 10. The unit is GB.

  • For a cluster instance, the storage space of a shard node can be 10 to 2000 GB, and the config storage space is 20 GB. This parameter is invalid for mongos nodes. Therefore, you do not need to specify the storage space for mongos nodes.
  • For a replica set instance, the value ranges from 10 to 3000.
  • For a single node instance, the value ranges from 10 to 1000.
spec_code
string Yes

Specifies the resource specification code.

Parameter:
backup_strategy
NameTypeMandatoryDescription
start_time
string Yes

Specifies the backup time window. Automated backups will be triggered during the backup time window. The value cannot be empty. It must be a valid value in the "hh:mm-HH:MM" format. The current time is in the UTC format.

  • The HH value must be 1 greater than the hh value.
  • The values of mm and MM must be the same and must be set to 00, 15, 30, or 45.
keep_days
string No

Specifies the number of days to retain the generated backup files. The value range is from 0 to 732.

  • If this parameter is set to 0, the automated backup policy is not set.
  • If this parameter is not transferred, the automated backup policy is enabled by default. Backup files are stored for seven days by default.
Parameter:
restore_point
NameTypeMandatoryDescription
instance_id
string No

Specifies the instance ID, which can be obtained by calling the API for querying instances and details. If you do not have an instance, you can call the API used for creating an instance.

  • This parameter is optional when type is set to backup.
  • This parameter is mandatory when type is set to timestamp.
type
string No

Specifies the recovery mode. The enumerated values are as follows:

  • backup: indicates restoration from backup files. In this mode, backup_id is mandatory when type is optional.
  • timestamp: indicates point-in-time restoration. In this mode, restore_time is mandatory when type is mandatory.
backup_id
string No

Specifies the ID of the backup to be restored. This parameter must be specified when the backup file is used for restoration. When type is not mandatory, backup_id is mandatory.

restore_time
string No

Specifies the time point of data restoration in the UNIX timestamp. The unit is millisecond and the time zone is UTC. When type is mandatory, restore_time is mandatory.

Response Parameters
Status code: 202

Success.

NameTypeDescription
id
string

Indicates the DB instance ID.

datastore
Datastore object

Indicates the database information, which is the same as the request parameter.

name
string

Indicates the DB instance name.

created
string

Indicates the creation time in the following format: yyyy-mm-dd hh:mm:ss.

status
string

Indicates the DB instance status. The value is creating.

region
string

Indicates the region ID, which is the same as the request parameter.

availability_zone
string

Indicates the AZ ID, which is the same as the request parameter.

vpc_id
string

Indicates the VPC ID, which is the same as the request parameter.

subnet_id
string

Indicates the VPC ID, which is the same as the request parameter.

security_group_id
string

Indicates the ID of the security group to which the instance belongs, which is the same as the request parameter.

disk_encryption_id
string

Indicates the ID of the disk encryption key, which is the same as the request parameter.

mode
string

Indicates the instance type, which is the same as the request parameter.

flavor
Array of RestoreNewInstanceFlavorOption objects

Indicates the instance specification, which is the same as the request parameter.

backup_strategy
BackupStrategy object

Indicates the advanced backup policy, which is the same as the request parameter.

enterprise_project_id
string

Indicates the enterprise project ID. If the value is 0, the resource belongs to the default enterprise project.

ssl_option
string

Indicates whether to enable SSL, which functions the same as the request parameter.

dss_pool_id
string

Indicates the DSS storage pool ID of the DeC user.

job_id
string

Indicates the ID of the workflow for creating a DB instance.

202 datastore
NameTypeDescription
type
string

Specifies the database type. The value is DDS-Community.

version
string

Specifies the database version. Versions 3.4 or later are supported. The value is 3.4, 4.0, 4.2, 4.4, or 5.0.

storage_engine
string

Specifies the storage engine. Currently, DDS supports the WiredTiger storage engine. The value is wiredTiger.

202 flavor
NameTypeDescription
type
string

Specifies the node type. Valid value:

  • For a cluster instance, the value can be mongos, shard, or config.
  • For a replica set instance, the value is replica.
  • For a single node instance, the value is single.
num
string

Specifies node quantity. Valid value:

  • In a cluster instance, the number of mongos nodes ranges from 2 to 32.
  • In a cluster instance, the number of shard nodes ranges from 2 to 32.
  • shard: The value ranges from 2 to 32.
  • config: The value is 1.
  • replica: The number of nodes can be 3, 5, or 7.
  • single: The value is 1.
size
string

Specifies the disk size. The value must be a multiple of 10. The unit is GB.

  • For a cluster instance, the storage space of a shard node can be 10 to 2000 GB, and the config storage space is 20 GB. This parameter is invalid for mongos nodes. Therefore, you do not need to specify the storage space for mongos nodes.
  • For a replica set instance, the value ranges from 10 to 3000.
  • For a single node instance, the value ranges from 10 to 1000.
spec_code
string

Specifies the resource specification code.

202 backup_strategy
NameTypeDescription
start_time
string

Specifies the backup time window. Automated backups will be triggered during the backup time window. The value cannot be empty. It must be a valid value in the "hh:mm-HH:MM" format. The current time is in the UTC format.

  • The HH value must be 1 greater than the hh value.
  • The values of mm and MM must be the same and must be set to 00, 15, 30, or 45.
keep_days
string

Specifies the number of days to retain the generated backup files. The value range is from 0 to 732.

  • If this parameter is set to 0, the automated backup policy is not set.
  • If this parameter is not transferred, the automated backup policy is enabled by default. Backup files are stored for seven days by default.
Status code: default

Client or server error.

NameTypeDescription
error_code
string

Specifies the error returned when a task submission exception occurs.

error_msg
string

Specifies the description of the error returned when a task submission exception occurs.

Example Request
Example 1

Restoring a backup to a new cluster instance:

"POST https://{endpoint}/v3/054e292c9880d4992f02c0196d3ea468/instances"
{ "name": "test-cluster-01", "availability_zone": "bbb", "vpc_id": "674e9b42-cd8d-4d25-a2e6-5abcc565b961", "subnet_id": "f1df08c5-71d1-406a-aff0-de435a51007", "security_group_id": "7aa51dbf-5b63-40db-9724-dad3c4828b58", "password": "******", "restore_point": { "backup_id": "8f643d252d834a4c916b2db4322f99552734" }, "flavor": [ { "type": "mongos", "num": "2", "spec_code": "dds.mongodb.c6.medium.4.mongos" }, { "type": "shard", "size": "20", "spec_code": "dds.mongodb.c6.medium.4.shard" }, { "type": "config", "num": "1", "size": "20", "spec_code": "dds.mongodb.c6.large.2.config" } ], "backup_strategy": { "start_time": "08:15-09:15", "keep_days": "8" }, "ssl_option": "1", "dss_pool_id": "f5f84ed7-6f19-4bd4-99d7-b450ad6cc4dd", "server_group_policies": [ "anti-affinity" ] }
Example 2

Restoring a backup to a new replica set instance:

"POST https://{endpoint}/v3/054e292c9880d4992f02c0196d3ea468/instances"
{ "name": "test-replicaset", "availability_zone": "bbb", "vpc_id": "674e9b42-cd8d-4d25-a2e6-5abcc565b961", "subnet_id": "f1df08c5-71d1-406a-aff0-de435a51007", "security_group_id": "7aa51dbf-5b63-40db-9724-dad3c4828b58", "password": "******", "restore_point": { "backup_id": "8f643d252d834a4c916b2db4322f99552734" }, "flavor": [ { "type": "replica", "num": "1", "storage": "ULTRAHIGH", "size": "30", "spec_code": "dds.s2.medium.4.shard" } ], "backup_strategy": { "start_time": "08:15-09:15", "keep_days": "8" }, "ssl_option": "1" }
Example 3

Restoring a backup to a new single node instance:

"POST https://{endpoint}/v3/054e292c9880d4992f02c0196d3ea468/instances"
{ "name": "test-singlenode", "availability_zone": "bbb", "vpc_id": "674e9b42-cd8d-4d25-a2e6-5abcc565b961", "subnet_id": "f1df08c5-71d1-406a-aff0-de435a51007", "security_group_id": "7aa51dbf-5b63-40db-9724-dad3c4828b58", "password": "******", "restore_point": { "backup_id": "8f643d252d834a4c916b2db4322f99552734" }, "flavor": [ { "type": "single", "num": "1", "storage": "ULTRAHIGH", "size": "30", "spec_code": "dds.mongodb.c6.medium.4.single" } ], "backup_strategy": { "start_time": "08:15-09:15", "keep_days": "8" }, "ssl_option": "1" }
Example 4

Restoring a backup to a new replica set instance at a point in time:

"POST https://{endpoint}/v3/054e292c9880d4992f02c0196d3ea468/instances"
{ "name": "test-replicaset", "availability_zone": "bbb", "vpc_id": "674e9b42-cd8d-4d25-a2e6-5abcc565b961", "subnet_id": "f1df08c5-71d1-406a-aff0-de435a51007", "security_group_id": "7aa51dbf-5b63-40db-9724-dad3c4828b58", "password": "******", "restore_point": { "instance_id": "8f643d252d834a4c916b2db4322f9955in02", "type": "timestamp", "restore_time": 1607689584000 }, "flavor": [ { "type": "replica", "num": "1", "storage": "ULTRAHIGH", "size": "30", "spec_code": "dds.s2.medium.4.shard" } ], "backup_strategy": { "start_time": "08:15-09:15", "keep_days": "8" }, "ssl_option": "1" }
Example Response
Status code: 202

Success.

Example 1
{
"id": "39b6a1a278844ac48119d86512e0000bin02",
"name": "test-cluster-01",
"datastore": {
"type": "DDS-Community",
"version": "3.2",
"storage_engine": "wiredTiger"
},
"created": "2019-01-16 09:34:36",
"status": "creating",
"region": "aaa",
"availability_zone": "bbb",
"vpc_id": "490a4a08-ef4b-44c5-94be-3051ef9e4fce",
"subnet_id": "0e2eda62-1d42-4d64-a9d1-4e9aa9cd994f",
"security_group_id": "2a1f7fc8-3307-42a7-aa6f-42c8b9b8f8c5",
"disk_encryption_id": "2gfdsh-844a-4023-a776-fc5c5fb71fb4",
"mode": "Sharding",
"flavor": [
{
"type": "mongos",
"num": "2",
"spec_code": "dds.mongodb.c6.medium.4.mongos"
},
{
"type": "shard",
"num": "2",
"spec_code": "dds.mongodb.c6.medium.4.shard",
"size": "20"
},
{
"type": "config",
"num": "1",
"spec_code": "dds.mongodb.c6.large.2.config",
"size": "20"
}
],
"backup_strategy": {
"start_time": "08:15-09:15",
"keep_days": "8"
},
"enterprise_project_id": "",
"ssl_option": "1",
"dss_pool_id": "f5f84ed7-6f19-4bd4-99d7-b450ad6cc4dd",
"job_id": "c010abd0-48cf-4fa8-8cbc-090f093eaa2f"
}
SDK
Click 文档数据库服务 (DDS) SDK to download the SDK in your programming language or view the SDK documentation. To learn how to install an SDK and perform authentication, read Usage.
Error Code

Outline

API Description
Constraints
URL
Request Parameters
Response Parameters
Example Request
Example Response
SDK
Error Code