CreateDBInstance - 创建或克隆副本集实例

重要

本文中含有需要您注意的重要提示信息,忽略该信息可能对您的业务造成影响,请务必仔细阅读。

创建或克隆云数据库MongoDB版副本集实例。

接口说明

请确保在使用该接口前,已充分了解云数据库 MongoDB 产品的收费方式和价格

关于云数据库 MongoDB 实例的规格,请参见实例规格表

如需创建分片集群实例,您可以通过调用 CreateShardingDBInstance 接口进行创建。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。

  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。

  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:

    • 对于必选的资源类型,用前面加 * 表示。

    • 对于不支持资源级授权的操作,用全部资源表示。

  • 条件关键字:是指云产品自身定义的条件关键字。

  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。

操作

访问级别

资源类型

条件关键字

关联操作

dds:CreateDBInstance

create

*Instance

acs:dds:{#regionId}:{#accountId}:dbinstance/*

请求参数

名称

类型

必填

描述

示例值

RegionId

string

地域 ID,您可以通过调用 DescribeRegions 接口查询地域 ID。

说明

调用本接口克隆实例或者回收站恢复实例时,该参数值需和源实例保持一致。

cn-hangzhou

ClientToken

string

用于保证请求的幂等性,防止重复提交请求。由客户端生成该参数值,要保证在不同请求间唯一,最大值不超过 64 个 ASCII 字符,且该参数值中不能包含非 ASCII 字符。

ETnLKlblzczshOTUbOCz****

ZoneId

string

可用区 ID,您可以通过调用 DescribeRegions 接口查询可用区 ID。

cn-hangzhou-g

EngineVersion

string

数据库版本号,取值:

  • 8.0

  • 7.0

  • 6.0

  • 5.0

  • 4.4

  • 4.2

  • 4.0

说明

调用本接口克隆实例或者回收站恢复实例时,该参数值需和源实例保持一致。

警告

3.4 及以下版本已停售。

4.4

DBInstanceClass

string

实例规格,您可以通过调用 DescribeAvailableResource 接口查询实例规格。

dds.mongo.standard

DBInstanceStorage

integer

实例存储空间,单位:GB。

具体取值受实例规格约束,详情请参见副本集实例规格表

10

DBInstanceDescription

string

实例名称,取值说明:

  • 以中文、英文字母开头。

  • 可以包含数字、中文、英文、下划线(_)、点(.)和短横线(-)。

  • 长度为 2~256 个字符。

test

SecurityIPList

string

实例的 IP 白名单,多个 IP 地址请用英文逗号(,)分隔,不可重复。支持如下三种格式:

  • 0.0.0.0/0

  • IP 地址形式,例如:10.23.12.24。

  • CIDR 形式,例如:10.23.12.0/24(无类域间路由,24 表示了地址中前缀的长度,范围为 1~32)。

说明
  • 每个实例最多添加 1000 个 IP 或 IP 段,即所有 IP 白名单分组内的 IP 或 IP 段总和不能超过 1000。

  • 0.0.0.0/0 表示任何 IP 地址都可以访问实例的数据库,属于高危设置,请谨慎设置。

192.168.xx.xx,192.168.xx.xx

AccountPassword

string

root 账号的密码,取值说明:

  • 由大写字母、小写字母、数字和特殊字符中的至少三种组成。

  • !@#$%^&*()_+-=为特殊字符。

  • 长度为 8~32 个字符。

说明

关于特殊字符导致数据库连接失败的问题请参见如何解决连接串中账号密码包含特殊字符导致连接失败的问题?

123456Aa

Period

integer

实例的购买时长,单位为月。

取值范围:1~9(整数)、12243660

说明

ChargeType 参数值为 PrePaid 时,该参数可用且为必填参数。

1

ChargeType

string

实例的付费类型,取值说明:

  • PostPaid:默认值,后付费(按量付费)。

  • PrePaid:预付费(包年包月)。

说明

当该参数的值为 PrePaid 时,您还需要配置 Period 参数。

PrePaid

NetworkType

string

实例的网络类型,取值说明:

VPC:专有网络。

VPC

VpcId

string

专有网络(VPC)ID。

vpc-bp175iuvg8nxqraf2****

VSwitchId

string

虚拟交换机 ID。

vsw-bp1gzt31twhlo0sa5****

SrcDBInstanceId

string

源实例 ID。

说明

调用本接口克隆实例时,您需要配置该参数,同时还需要配置 BackupIdRestoreTime 参数。调用本接口进行回收站恢复时,只需要传入该参数,无需配置 BackupIdRestoreTime

dds-bp1ee12ad351****

BackupId

string

备份点 ID,您可以通过调用 DescribeBackups 接口查询备份点 ID。

说明

只有调用本接口按备份点克隆实例时,您需要配置该参数,同时还需要配置 SrcDBInstanceId 参数。

32994****

RestoreTime

string

选择要恢复的时间点,您可以配置 7 天内的任意时间点。格式为yyyy-MM-ddTHH:mm:ssZ(UTC 时间)。

说明

只有调用本接口按时间点克隆实例时,您需要配置该参数,同时还需要配置 SrcDBInstanceId 参数。

2022-03-13T12:11:14Z

BusinessInfo

string

附加参数,业务信息。

{“ActivityId":"000000000"}

AutoRenew

string

实例是否自动续费,取值说明:

  • true:自动续费。

  • false:默认值,不自动续费,即手动续费。

说明

ChargeType 参数值为 PrePaid 时,该参数可用且为可选参数。

true

DatabaseNames

string

数据库名。

说明

调用本接口克隆实例时,您可以通过配置该参数指定需要克隆的数据库,如果不配置该参数,则克隆实例的所有数据库。

mongodbtest

CouponNo

string

是否使用优惠券,取值说明:

  • defaultnull(默认):使用优惠券。

  • youhuiquan_promotion_option_id_for_blank:不使用优惠券。

default

StorageEngine

string

实例的存储引擎,取值固定为 WiredTiger

说明
  • 调用本接口克隆实例或回收站恢复实例时,该参数需和源实例保持一致。

  • 关于存储引擎与版本的选择约束,请参见版本与存储引擎

WiredTiger

ReplicationFactor

string

副本集实例的主备节点数,取值:

  • 3(默认值)

  • 5

  • 7

重要

单节点实例可不传该参数

3

ReadonlyReplicas

string

副本集实例的只读节点数,取值范围:0~5(整数),默认值为 0

0

ResourceGroupId

string

资源组 ID。

rg-acfmyiu4ekp****

ClusterId

string

专属集群 ID。

dhg-2x78****

Engine

string

数据库引擎,固定取值:MongoDB

MongoDB

StorageType

string

存储类型,取值说明:

  • cloud_essd1:ESSD PL1 云盘。

  • cloud_essd2:ESSD PL2 云盘。

  • cloud_essd3:ESSD PL3 云盘。

  • cloud_auto:ESSD AutoPL 云盘。

  • local_ssd:SSD 本地盘。

说明
  • 单节点实例购买传递 cloud_essd1,实际使用 cloud_essd 云盘。

  • ESSD AutoPL 云盘目前仅支持中国站。

  • 4.4 及以上版本实例默认为cloud_essd1

  • 4.2 及以下版本实例默认为local_ssd

cloud_essd1

SecondaryZoneId

string

配置从节点(Secondary 节点)所在的可用区,实现多可用区部署。取值说明:

  • cn-hangzhou-g:杭州可用区 G。

  • cn-hangzhou-h:杭州可用区 H。

  • cn-hangzhou-i:杭州可用区 I。

  • cn-hongkong-b:中国香港可用区 B。

  • cn-hongkong-c:中国香港可用区 C。

  • cn-hongkong-d:中国香港可用区 D。

  • cn-wulanchabu-a:乌兰察布可用区 A。

  • cn-wulanchabu-b:乌兰察布可用区 B。

  • cn-wulanchabu-c:乌兰察布可用区 C。

  • ap-southeast-1a:新加坡可用区 A。

  • ap-southeast-1b:新加坡可用区 B。

  • ap-southeast-1c:新加坡可用区 C。

  • ap-southeast-5a:雅加达可用区 A。

  • ap-southeast-5b:雅加达可用区 B。

  • ap-southeast-5c:雅加达可用区 C。

  • eu-central-1a:法兰克福可用区 A。

  • eu-central-1b:法兰克福可用区 B。

  • eu-central-1c:法兰克福可用区 C。

说明
  • 当实例为云盘类型时,该参数可用。

  • 该参数取值不能与 ZoneIdHiddenZoneId 参数值相同。

cn-hangzhou-h

HiddenZoneId

string

配置隐藏节点(Hidden 节点)所在的可用区,实现多可用区部署。取值说明:

  • cn-hangzhou-g:杭州可用区 G。

  • cn-hangzhou-h:杭州可用区 H。

  • cn-hangzhou-i:杭州可用区 I。

  • cn-hongkong-b:中国香港可用区 B。

  • cn-hongkong-c:中国香港可用区 C。

  • cn-hongkong-d:中国香港可用区 D。

  • cn-wulanchabu-a:乌兰察布可用区 A。

  • cn-wulanchabu-b:乌兰察布可用区 B。

  • cn-wulanchabu-c:乌兰察布可用区 C。

  • ap-southeast-1a:新加坡可用区 A。

  • ap-southeast-1b:新加坡可用区 B。

  • ap-southeast-1c:新加坡可用区 C。

  • ap-southeast-5a:雅加达可用区 A。

  • ap-southeast-5b:雅加达可用区 B。

  • ap-southeast-5c:雅加达可用区 C。

  • eu-central-1a:法兰克福可用区 A。

  • eu-central-1b:法兰克福可用区 B。

  • eu-central-1c:法兰克福可用区 C。

说明
  • 当实例为云盘类型时,该参数可用。

  • 该参数值不能与 ZoneIdSecondaryZoneId 参数值相同。

cn-hangzhou-i

Tag

array<object>

用户自定义标签。

object

Key

string

标签的键。

说明
  • N 表示传入第几个标签的键。例如:Tag.1.Key表示传入第一个标签的键;Tag.2.Key表示传入第二个标签的键。

testdatabase

Value

string

标签的值。

说明

N 表示传入第几个标签的值。例如:Tag.1.Value表示传入第一个标签的值;Tag.2.Value表示传入第二个标签的值。

apitest

GlobalSecurityGroupIds

string

实例的全局 IP 白名单模板,多个 IP 白名单模板请用英文逗号(,)分隔,不可重复。(功能灰度中)

g-qxieqf40xjst1ngpr3jz

Encrypted

boolean

是否开启云盘加密

true

EncryptionKey

string

自定义密钥 ID。

2axxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

ProvisionedIops

integer

预配置性能(IOPS)。取值范围为 0~50000。

1960

RestoreType

string

备份恢复实例。

  • 0: 恢复实例到指定备份集

  • 1: 恢复实例到指定时间点

  • 2: 恢复已释放实例到指定备份集

  • 3: 恢复实例到指定的异地备份集

0

SrcRegion

string

源实例所在区域。

说明
  • 当备份恢复类型为 2 或 3 时,需要且必填

2

返回参数

名称

类型

描述

示例值

object

RequestId

string

请求 ID。

D8F1D721-6439-4257-A89C-F1E8E9C9****

DBInstanceId

string

实例 ID。

dds-bp144a7f2db8****

OrderId

string

订单 ID。

21077576248****

示例

正常返回示例

JSON格式

{
  "RequestId": "D8F1D721-6439-4257-A89C-F1E8E9C9****",
  "DBInstanceId": "dds-bp144a7f2db8****",
  "OrderId": "21077576248****"
}

错误码

HTTP status code

错误码

错误信息

描述

400 SecurityRisk.AuthVerification we have detected a risk with your default payment method. An email and notification has been sent to you. Please re-submit your order before after verificaiton.
400 MissingParameter Period is mandatory for this action.
400 ORDER.ACCOUNT_INFORMATION_INCOMPLETE Your information is incomplete. Complete your information before ordering.
400 InvalidClientToken.Malformed Specified parameter ClientToken is not valid.
400 InvalidDBInstanceDescription.Malformed Specified parameter DBInstanceDescription is not valid. 节点名称不合法
400 InvalidSecurityIPListLength.Malformed The quota of security ip exceeds.
400 InsufficientBalance Your account does not have enough balance.
400 QuotaExceed.AfterpayInstance Living afterpay instances quota exceeded.
400 InvalidCapacity.NotFound The Capacity provided does not exist in our records.
400 ResourceNotAvailable Resource you requested is not available for finance user.
400 IdempotentParameterMismatch Request uses a client token in a previous request but is not identical to that request.
400 InvalidSecurityIPList.Malformed The specified parameter "SecurityIPList" is not valid.
400 InvalidSecurityIPList.Duplicate The Security IP address is not in the available range or occupied.
400 InvalidDBInstanceStorage.ValueNotSupported The specified parameter DBInstanceStorage is not valid.
400 InvalidAccountPassword.Malformed Specified parameter AccountPassword is not valid.
400 TokenServiceError Duplicate ClientToken request.
400 Zone.Closed The specified zone is closed.
400 PRICE.ORIGIN_PRICE_ERROR The origin price error.
400 NO_AVAILABLE_PAYMENT_METHOD No payment method is specified for your account. We recommend that you add a payment method.
400 InvalidEcsImage.NotFound Specified ecs image does not exist.
400 SaleValidateNoSpecificCodeFailed Specified Storage or Version or InstanceClass is invalid. Storage 或 Version 或 InstanceClass 为空。
400 Trade_Not_Support_Async_Pay Trade not support async pay.
400 InvalidZoneld The specified primary zone, secondary zone and hidden zone cannot be the same. 选择的主可用区、备可用区1和备可用区2参数不能完全相同。
400 SameZoneId The specified primary zone, secondary zone require two different zones. 选择的主可用区、备可用区参数要求不同。
403 RealNameAuthenticationError Your account has not passed the real-name authentication yet.
403 RegionUnauthorized There is no authority to create instance in the specified region.
403 OperationDenied The resource is out of usage. The resource is out of usage.
403 InvalidEngineVersionInRegion.NotAvailable The EngineVersion in the Region is not available.
403 InvalidBackupLogStatus Current backup log enable status does not support this operation.
403 IncorrectBackupSetState Current backup set state does not support operations.
404 InvalidBackup.NotFound The available backup does not exist in recovery time.

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情