ALIYUN::POLARDB::DBCluster

ALIYUN::POLARDB::DBCluster类型用于创建PolarDB集群。

语法

{
  "Type": "ALIYUN::POLARDB::DBCluster",
  "Properties": {
    "VpcId": String,
    "DBClusterDescription": String,
    "DBType": String,
    "ClusterNetworkType": String,
    "RenewalStatus": String,
    "AutoRenewPeriod": Integer,
    "Period": Integer,
    "ZoneId": String,
    "SecurityGroupIds": List,
    "Tags": List,
    "SourceResourceId": String,
    "MaintainTime": String,
    "DBVersion": String,
    "CreationOption": String,
    "DBNodeClass": String,
    "VSwitchId": String,
    "SecurityIPList": String,
    "CloneDataPoint": String,
    "PayType": String,
    "CreationCategory": String,
    "BackupRetentionPolicyOnClusterDeletion": String,
    "ResourceGroupId": String,
    "DefaultTimeZone": String,
    "GDNId": String,
    "LowerCaseTableNames": Integer,
    "DBClusterParameters": Map,
    "TDEStatus": Boolean,
    "PeriodUnit": String,
    "ScaleRoNumMin": Integer,
    "ScaleMax": Integer,
    "AllowShutDown": Boolean,
    "ServerlessType": String,
    "ScaleRoNumMax": Integer,
    "ScaleMin": Integer,
    "StorageType": String,
    "LooseXEngine": String,
    "LoosePolarLogBin": String,
    "StorageSpace": Integer,
    "ProxyType": String,
    "StandbyAZ": String,
    "LooseXEngineUseMemoryPct": Integer,
    "StorageUpperBound": Integer,
    "StrictConsistency": String,
    "StoragePayType": String,
    "DBNodeNum": Integer,
    "ProxyClass": String,
    "HotStandbyCluster": String,
    "StorageAutoScale": String,
    "Architecture": String,
    "DBMinorVersion": String,
    "ParameterGroupId": String,
    "RestartMasterNode": Boolean,
    "ColdStorageOption": Map,
    "ProvisionedIops": Integer,
    "DeletionProtection": Boolean,
    "SSLEnabled": String
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

DBType

String

数据库引擎类型。

取值:

  • MySQL

  • PostgreSQL

  • Oracle

DBNodeClass

String

节点规格。

节点规格,详情请参见如下文档:

说明

PolarDB MySQL 集群版中如需创建 Serverless 集群,请传入polar.mysql.sl.small

PolarDB MySQL 标准版如需创建 Serverless 集群,请传入polar.mysql.sl.small.c

PolarDB PostgreSQL 版(兼容 Oracle)和 PolarDB PostgreSQL 版中如需创建 Serverless 集群,请传入polar.pg.sl.small.c

DBVersion

String

数据库版本号。

取值:

  • MySQL 版本号取值范围如下:

    • 5.6

    • 5.7

    • 8.0

  • PostgreSQL 版本号取值范围如下:

    • 11

    • 14

    • 15

      说明

      PolarDB PostgreSQL 版中如需创建 Serverless 集群,版本号只支持 14。

  • Oracle 版本号取值范围如下:

    • 11

    • 14

PayType

String

付费类型。

取值:

  • Postpaid:按量付费。

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

AutoRenewPeriod

Integer

实例自动续费时长。

取值:

  • 1(默认值)

  • 2

  • 3

  • 6

  • 12

  • 24

  • 36

单位:月。

DBClusterDescription

String

集群描述。

长度为2~256个字符。以英文字母或汉字开头,不能以http://https://开头。可包含英文字母、汉字、数字、半角逗号(,)和短划线(-) 。

ClusterNetworkType

String

集群网络类型。

当前仅支持专有网络,取值:VPC。

RenewalStatus

String

自动续费状态。

取值:

  • AutoRenewal:自动续费。

  • Normal(默认值):手动续费。

  • NotRenewal:不再续费。

    说明

    设置为NotRenewal后,系统不再发送到期提醒,只在到期前第三天发送不续费提醒。

Period

Integer

预付费类型(即PayTypePrepaid时)实例的时长。

取值:

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 12

  • 24

  • 36

单位:月。

ZoneId

String

可用区ID。

您可以通过DescribeRegions接口查询可选的可用区。

SourceResourceId

String

RDS实例ID或源PolarDB集群ID。

源 RDS 实例 ID 或源 PolarDB 集群 ID。仅当 CreationOption 为 MigrationFromRDSCloneFromRDSCloneFromPolarDB 或 RecoverFromRecyclebin 时,该参数必填。

  • 若 CreationOption 为 MigrationFromRDS 或 CloneFromRDS,您需要为本参数传入源 RDS 实例 ID。源 RDS 实例版本需为 RDS MySQL 5.6 、5.7 或 8.0 高可用版。

  • 若 CreationOption 为 CloneFromPolarDB,您需要为本参数传入源 PolarDB 集群 ID。克隆集群和源集群的 DBType 默认保持一致。例如源集群为 MySQL 8.0,则克隆集群也需设置 DBType 为 MySQL 且 DBVersion 为8.0

  • 若 CreationOption 为 RecoverFromRecyclebin,您需要为本参数传入已释放的源 PolarDB 集群 ID。从回收站恢复的集群和源集群的 DBType 需保持一致。例如源集群为 MySQL 8.0,则从回收站恢复的集群也需设置 DBType 为 MySQL 且 DBVersion 为8.0

SecurityGroupIds

List

安全组ID列表。

最多支持3个安全组。

Tags

List

标签。

最多支持添加20个标签。

更多信息,请参见Tags属性

MaintainTime

String

集群的可维护时间。

格式:HH:mmZ-HH:mmZ。例如:16:00Z-17:00Z,表示0点到1点(UTC+08:00)可进行例行维护。

CreationOption

String

创建方式。

创建方式,取值范围如下:

默认为 Normal

说明

当 DBType 为 MySQL 且 DBVersion 为8.0时,本参数取值可以为 CreateGdnStandby

VSwitchId

String

交换机ID。

SecurityIPList

String

PolarDB集群白名单。

说明

支持配置多个白名单 IP 地址,多个 IP 地址之间使用英文逗号分隔。

CloneDataPoint

String

克隆数据的时间节点。

取值:

  • LATEST(默认值):最新时间点的数据。

    说明

    CreationOption取值为CloneFromRDS时,该参数取值为LATEST。

  • BackupID:历史备份集ID。

  • Timestamp:历史时间点,格式:yyyy-MM-ddTHH:mm:ssZ(UTC时间)。

说明

若 CreationOption 为 CloneFromRDS,则本参数取值只能为 LATEST

CreationCategory

String

集群系列。

产品系列,取值范围如下:

  • Normal:集群版(默认值)

  • Basic:单节点

  • ArchiveNormal:高压缩引擎(X-Engine)

  • NormalMultimaster:多主架构集群版

  • SENormal:标准版

说明

MySQL 5.65.78.0PostgreSQL 14 以及 Oracle 语法兼容 2.0 版支持 Basic

MySQL 8.0支持 ArchiveNormal 和 NormalMultimaster

MySQL 5.65.78.0和 PostgreSQL 14 支持 SENormal

BackupRetentionPolicyOnClusterDeletion

String

删除集群时备份集保留策略。

取值:

  • ALL:永久保留全部备份。

  • LATEST:永久保留最后一个备份(删除前自动备份)。

  • NONE(默认值):集群删除时不保留备份集。

创建集群时,默认取值为 NONE,即集群删除时不保留备份集。

说明
  • 仅当 DBType 为 MySQL 时,该参数生效。

  • Serverless 集群不支持该参数。

ResourceGroupId

String

资源组ID。

DefaultTimeZone

String

集群时区(UTC)。

默认取值为SYSTEM,默认时区与Region所在时区一致。

可选取值范围为-12:00~+13:00内的所有整数时间点,如 00:00。

说明

仅当DBType取值为MySQL时,该参数生效。

GDNId

String

全球数据库网络ID。

CreationOption取值为CreateGdnStandby时,该参数必填。

LowerCaseTableNames

Integer

表名是否区分大小写。

取值:

  • 1(默认值):不区分大小写。

  • 0:区分大小写。

说明

仅当DBTypeMySQL时,该参数生效。

DBClusterParameters

Map

PolarDB集群的参数。

更多信息,请参见DBClusterParameters属性

DeletionProtection

Boolean

是否开启删除保护。

取值:

  • true:开启删除保护。

  • false(默认值):不开启删除保护。

TDEStatus

Boolean

是否开启透明数据加密(TDE)。

取值:

  • true:开启。

    说明

    TDE功能开启后不可关闭。

  • false(默认值):关闭。

说明

DBType取值为PostgreSQLDBType取值为Oracle时,该参数生效。

PeriodUnit

String

时长单位。

取值:

  • Year:年。

  • Month:月。

ScaleRoNumMin

Integer

只读节点数的最小扩容和缩容限制。

取值范围:0~15。

说明

仅 Serverless 集群支持该参数。

ScaleMax

Integer

单节点扩容和缩容的最大限制。

取值范围:1 PCU~32 PCU。

说明

仅 Serverless 集群支持该参数。

AllowShutDown

Boolean

是否开启无活动暂停。

取值:

  • true:开启无活动暂停。

  • false:关闭无活动暂停。

说明

仅 Serverless 集群支持该参数。

ServerlessType

String

Serverless服务类型。

取值:AgileServerless。

说明

仅 Serverless 集群支持该参数。

ScaleRoNumMax

Integer

只读节点数的最大扩容和缩容限制。

取值范围:0~15。

说明

仅 Serverless 集群支持该参数。

ScaleMin

Integer

单节点扩容和缩容的最小限制。

取值范围:1 PCU~31 PCU。

说明

仅 Serverless 集群支持该参数。

SSLEnabled

String

修改SSL状态。

取值:

  • Disable:禁用SSL加密。

  • Enable:启用SSL加密。

  • Update:更新SSL证书。

StorageType

String

存储类型。

企业版存储类型取值如下:

  • PSL5

  • PSL4

标准版存储类型取值如下:

  • ESSDPL0

  • ESSDPL1

  • ESSDPL2

  • ESSDPL3

  • ESSDAUTOPL

LooseXEngine

String

开启X-Engine存储引擎功能。

取值:

  • ON:集群开启X-Engine引擎

  • OFF:集群关闭X-Engine引擎

说明

当参数CreationOption不等于CreateGdnStandbyDBTypeMySQLDBVersion8.0时,该参数才生效。开启X-Engine引擎的节点内存规格必须大于等于16 GB。

LoosePolarLogBin

String

开启Binlog功能。

取值:

  • ON:集群开启Binlog功能

  • OFF:集群关闭Binlog功能

说明

当参数DBTypeMySQL时,该参数才生效。

StorageSpace

Integer

按空间计费(包年包月)的存储空间。

单位:GB。

说明
  • PolarDB MySQL 标准版存储空间的取值范围:20~32000。

  • 标准版存储类型为 ESSDAUTOPL 时,存储空间的取值范围:40~64000,步长最小为 10,即只能填写 40、50、60...以此类推。

ProxyType

String

数据库代理类型。

取值范围如下:

  • EXCLUSIVE:企业独享版

  • GENERAL:企业通用版

说明

代理类型需要与集群的节点规格对应的类型保持一致。即:

节点规格为通用规格,则代理类型应为企业通用版;

节点规格为独享规格,则代理类型应为企业独享版。

StandbyAZ

String

存储热备集群的可用区。

适用于标准版3AZ场景。

说明

开启了多可用区数据强一致,该参数才生效。

LooseXEngineUseMemoryPct

Integer

设置开启X-Engine存储引擎比例。

取值范围10~90的整数。

说明

当参数LooseXEngineON时,该参数才生效。

StorageUpperBound

Integer

设置标准版集群存储自动扩容上限。

单位:GB。

说明

取值最大为32000。

StrictConsistency

String

集群是否开启了多可用区数据强一致。

取值:

  • ON:表示开启了多可用区数据强一致,适用于标准版3AZ场景。

  • OFF:表示未开启多可用区数据强一致。

StoragePayType

String

存储计费类型。

取值:

  • Postpaid:按容量计费(按量付费)。

  • Prepaid:按空间计费(包年包月)。

DBNodeNum

Integer

标准版和企业版节点个数。

取值如下:

  • 标准版取值范围:1~8(支持 1 个读写节点和 7 个只读节点)。

  • 企业版取值范围:1~16(支持 1 个读写节点和 15 个只读节点)。

说明
  • 企业版默认有 2 个节点,标准版默认有 1 个节点。

  • 仅 PolarDB MySQL 版支持该参数。

  • 目前暂不支持多主集群节点数量变更设置。

ProxyClass

String

标准版数据库代理规格。

取值:

  • polar.maxscale.g2.medium.c:2 核。

  • polar.maxscale.g2.large.c:4 核。

  • polar.maxscale.g2.xlarge.c:8 核。

  • polar.maxscale.g2.2xlarge.c:16 核。

  • polar.maxscale.g2.3xlarge.c:24 核。

  • polar.maxscale.g2.4xlarge.c:32 核。

  • polar.maxscale.g2.8xlarge.c:64 核。

HotStandbyCluster

String

是否开启热备集群。

取值:

  • ON(默认):开启热备集群。

  • OFF:关闭热备集群。

  • STANDBY:标准版开启热备集群。

说明

标准版集群的默认值为STANDBY

StorageAutoScale

String

标准版集群是否开启存储自动扩容。

取值:

  • Enable:开启存储自动扩容。

  • Disable:关闭存储自动扩容。

Architecture

String

CPU 架构。

取值:

  • X86

  • ARM

DBMinorVersion

String

数据库引擎小版本号。

取值:

  • 8.0.2

  • 8.0.1

说明

当参数 DBType 为 MySQL 且 DBVersion 为8.0时,该参数才生效。

VpcId

String

专有网络ID。

ParameterGroupId

String

参数模板ID。

您可以通过DescribeParameterGroups接口查看目标地域的参数模板列表,包括参数模板ID。

RestartMasterNode

Boolean

是否重启主节点。

取值:

  • true:重启主节点。

  • false:不重启主节点。

ColdStorageOption

Map

冷数据归档选项。

更多信息,请参见ColdStorageOption属性

ProvisionedIops

Integer

ESSD AutoPL 云盘预配置的读写 IOPS。

可能值:0~min{50,000, 1000*容量-基准性能}。

基准性能=min{1,800+50*容量, 50000}。

说明

当 StorageType 为 ESSDAUTOPL 时才支持该参数。

Tags语法

"Tags": [
  {
    "Key": String,
    "Value": String
  }
]  

Tags属性

属性名称

类型

必须

允许更新

描述

约束

Key

String

标签键。

长度为1~128个字符,不能以aliyunacs:开头,不能包含http://或者https://

Value

String

标签值。

长度为0~128个字符,不能以aliyunacs:开头,不能包含http://或者https://

DBClusterParameters语法

"DBClusterParameters": {
  "Parameters": String,
  "EffectiveTime": String
}

DBClusterParameters属性

属性名称

类型

必须

允许更新

描述

约束

Parameters

String

参数及其值的JSON字符串。

参数的值都是字符串类型。

EffectiveTime

String

参数的生效时间。

取值:

  • Auto:自动确定何时生效。

  • Immediately:立即生效。

  • MaintainTime:集群维护期间生效。

ColdStorageOption语法

"ColdStorageOption": {
  "Description": String,
  "Enable": Boolean
}

ColdStorageOption属性

属性名称

类型

必须

允许更新

描述

约束

Description

String

描述信息。

如果设置了描述信息,则表示开启了冷数据归档功能。 长度不超过256个字符。 

Enable

Boolean

开启冷数据归档功能。

取值:

  • true

  • false

返回值

Fn::GetAtt

  • DBClusterId:集群ID。

  • OrderId:订单ID。

  • DBNodeIds:集群节点ID。

  • PrimaryEndpointId:主地址ID。

  • CustomEndpointIds:自定义集群地址ID。

  • CustomConnectionStrings:自定义连接串。

  • PrimaryConnectionString:主连接串。

  • ClusterConnectionString:自定义连接串。

  • ClusterEndpointId:集群地址ID。

  • PrimaryEndpointIds:集群主地址ID列表。

  • PrimaryConnectionStrings:集群主地址连接串列表。

  • ColdStorageInstanceId:冷数据库实例ID。

  • DBClusterDescription:集群描述。

  • Arn:阿里云资源名称。

示例

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  VpcId:
    AssociationProperty: ALIYUN::ECS::VPC::VPCId
    Type: String
    Description:
      en: Please search the ID starting with (vpc-xxx) from console-Virtual Private Cloud
      zh-cn: 现有虚拟专有网络的实例ID
    Label:
      en: VPC ID
      zh-cn: 专有网络VPC实例ID
  VSwitchZoneId:
    AssociationProperty: ALIYUN::ECS::Instance:ZoneId
    Type: String
    Description:
      zh-cn: 交换机可用区
      en: VSwitch Availability Zone
    Label:
      zh-cn: 交换机可用区
      en: VSwitch Availability Zone
  VSwitchId:
    AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
    AssociationPropertyMetadata:
      VpcId: ${VpcId}
      ZoneId: ${VSwitchZoneId}
    Type: String
    Description:
      en: Instance ID of existing business network switches, console-Virtual Private Cloud-VSwitches under query
      zh-cn: 现有业务网络交换机的实例ID
    Label:
      en: VSwitch ID
      zh-cn: 交换机实例ID
  DBType:
    Type: String
    Description: |-
      Database type, value:
      MySQL
      PostgreSQL
      Oracle
    Default: MySQL
  DBVersion:
    Type: String
    Description: |-
      The version of the database. Valid values:
      MySQL: 5.6 or 8.0
      PostgreSQL: 11
      Oracle: 11
    Default: '5.6'
  DBNodeClass:
    Type: String
    Description: The node specifications of the cluster. For more information, see Specifications and pricing.
    Default: polar.mysql.x4.medium
Resources:
  DBCluster:
    Type: ALIYUN::POLARDB::DBCluster
    Properties:
      VpcId:
        Ref: VpcId
      DBType:
        Ref: DBType
      ClusterNetworkType: VPC
      ZoneId:
        Ref: VSwitchZoneId
      VSwitchId:
        Ref: VSwitchId
      DBVersion:
        Ref: DBVersion
      DBNodeClass:
        Ref: DBNodeClass
      PayType: Postpaid
Outputs:
  DBClusterId:
    Description: The ID of the ApsaraDB for POLARDB cluster.
    Value:
      Fn::GetAtt:
        - DBCluster
        - DBClusterId
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "VpcId": {
      "AssociationProperty": "ALIYUN::ECS::VPC::VPCId",
      "Type": "String",
      "Description": {
        "en": "Please search the ID starting with (vpc-xxx) from console-Virtual Private Cloud",
        "zh-cn": "现有虚拟专有网络的实例ID"
      },
      "Label": {
        "en": "VPC ID",
        "zh-cn": "专有网络VPC实例ID"
      }
    },
    "VSwitchZoneId": {
      "AssociationProperty": "ALIYUN::ECS::Instance:ZoneId",
      "Type": "String",
      "Description": {
        "zh-cn": "交换机可用区",
        "en": "VSwitch Availability Zone"
      },
      "Label": {
        "zh-cn": "交换机可用区",
        "en": "VSwitch Availability Zone"
      }
    },
    "VSwitchId": {
      "AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
      "AssociationPropertyMetadata": {
        "VpcId": "${VpcId}",
        "ZoneId": "${VSwitchZoneId}"
      },
      "Type": "String",
      "Description": {
        "en": "Instance ID of existing business network switches, console-Virtual Private Cloud-VSwitches under query",
        "zh-cn": "现有业务网络交换机的实例ID"
      },
      "Label": {
        "en": "VSwitch ID",
        "zh-cn": "交换机实例ID"
      }
    },
    "DBType": {
      "Type": "String",
      "Description": "Database type, value:\nMySQL\nPostgreSQL\nOracle",
      "Default": "MySQL"
    },
    "DBVersion": {
      "Type": "String",
      "Description": "The version of the database. Valid values:\nMySQL: 5.6 or 8.0\nPostgreSQL: 11\nOracle: 11",
      "Default": "5.6"
    },
    "DBNodeClass": {
      "Type": "String",
      "Description": "The node specifications of the cluster. For more information, see Specifications and pricing.",
      "Default": "polar.mysql.x4.medium"
    }
  },
  "Resources": {
    "DBCluster": {
      "Type": "ALIYUN::POLARDB::DBCluster",
      "Properties": {
        "VpcId": {
          "Ref": "VpcId"
        },
        "DBType": {
          "Ref": "DBType"
        },
        "ClusterNetworkType": "VPC",
        "ZoneId": {
          "Ref": "VSwitchZoneId"
        },
        "VSwitchId": {
          "Ref": "VSwitchId"
        },
        "DBVersion": {
          "Ref": "DBVersion"
        },
        "DBNodeClass": {
          "Ref": "DBNodeClass"
        },
        "PayType": "Postpaid"
      }
    }
  },
  "Outputs": {
    "DBClusterId": {
      "Description": "The ID of the ApsaraDB for POLARDB cluster.",
      "Value": {
        "Fn::GetAtt": [
          "DBCluster",
          "DBClusterId"
        ]
      }
    }
  }
}

更多示例,请参见创建PolarDB集群、为PolarDB数据库创建账号、在PolarDB集群下创建一个新的数据库、增加PolarDB集群节点、授权普通账号访问PolarDB集群的某个数据库、修改允许访问数据库集群的IP名单和创建PolarDB集群的公网地址的组合示例:YAML示例