ALIYUN::POLARDB::DBClusterEndpoint

ALIYUN::POLARDB::DBClusterEndpoint类型用于创建PolarDB自定义集群地址。

语法

{
  "Type": "ALIYUN::POLARDB::DBClusterEndpoint",
  "Properties": {
    "DBClusterId": String,
    "ReadWriteMode": String,
    "EndpointType": String,
    "AutoAddNewNodes": String,
    "Nodes": List,
    "EndpointConfig": Map
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

DBClusterId

String

集群ID。

ReadWriteMode

String

读写模式。

取值:

  • ReadWrite:可读可写,自动读写分离。

  • ReadOnly(默认值):只读。

EndpointType

String

自定义集群地址类型。

取值:Custom。

AutoAddNewNodes

String

新节点是否自动加入自定义集群地址。

取值:

  • Enable

  • Disable(默认值)

Nodes

List

用于处理读请求的节点。

示例值:["pi-bpsg35x****", "pi-bp3ddh****"]

取值至少包含两个节点。默认值为全部节点。

EndpointConfig

Map

一致性级别。

更多信息,请参见EndpointConfig属性

EndpointConfig语法

"EndpointConfig": {
  "ConsistLevel": String,
  "ConsistTimeout": String,
  "LoadBalancePolicy": String,
  "ConnectionPersist": String,
  "DistributedTransaction": String,
  "EnableOverloadThrottle": String,
  "MasterAcceptReads": String,
  "ConsistTimeoutAction": String,
  "EnableHtapImci": String,
  "MaxParallelDegree": String
}  

EndpointConfig属性

属性名称

类型

必须

允许更新

描述

约束

ConsistLevel

String

一致性级别。

取值:

  • 0:最终一致性

    说明

    如果参数ReadWriteMode取值为ReadOnly,一致性级别取值只能为0。

  • 1(默认值):会话一致性

ConsistTimeout

String

全局一致性读超时。

LoadBalancePolicy

String

设置负载均衡策略。

格式为{"LoadBalancePolicy":"负载均衡策略"}。

取值:

  • 0:基于连接数负载均衡(默认)。

  • 1:基于活跃请求数负载均衡。

ConnectionPersist

String

设置连接池。

格式为{"ConsistLevel":"连接池"}。

取值:

  • off:关闭连接池(默认值)。

  • Session:开启会话级连接池。

  • Transaction:开启事务级连接池。

DistributedTransaction

String

设置事务拆分。

格式为{"DistributedTransaction":"事务拆分"}。

取值:

  • on:开启事务拆分(默认值)。

  • off:关闭事务拆分。

EnableOverloadThrottle

String

设置是否开启过载保护。

格式为{"EnableOverloadThrottle":"是否开启过载保护"}。

取值:

  • on:开启过载保护。

  • off:关闭过载保护(默认)。

MasterAcceptReads

String

设置主库是否接受读。

格式为{"MasterAcceptReads":"主库不接受读"}。

取值:

  • on:表示主库接受读。

  • off:表示主库不接受读(默认值)。

ConsistTimeoutAction

String

全局一致性读超时策略。

取值:

  • 0:此请求发生在主节点(默认)。

  • 1:Sql错误报告。

EnableHtapImci

String

设置行存/列存自动引流。

格式为{"EnableHtapImci":"行存/列存自动引流"}。

取值:

  • on:开启行存/列存自动引流功能。

  • off:关闭行存/列存自动引流功能(默认)。

MaxParallelDegree

String

设置并行查询。

格式为{"MaxParallelDegree":"并行查询"}。

取值:

  • on:开启并行查询。

  • off:关闭并行查询(默认)。

返回值

Fn::GetAtt

  • DBEndpointId:集群地址ID。

  • ConnectionString:连接串。

  • Addresses:IP地址。

示例

YAML格式

ROSTemplateFormatVersion: '2015-09-01'
Resources:
  DBClusterEndpoint:
    Type: ALIYUN::POLARDB::DBClusterEndpoint
    Properties:
      DBClusterId:
        Ref: DBClusterId
      ReadWriteMode:
        Ref: ReadWriteMode
      EndpointConfig:
        Ref: EndpointConfig
      AutoAddNewNodes:
        Ref: AutoAddNewNodes
      Nodes:
        Fn::Split:
        - ","
        - Ref: Nodes
      EndpointType:
        Ref: EndpointType
Parameters:
  DBClusterId:
    Type: String
    Description: The ID of the ApsaraDB for POLARDB cluster for which a custom connection
      point is to be created.
  ReadWriteMode:
    Default: ReadOnly
    Type: String
    Description: 'The read/write mode of the cluster connection point. Valid values:ReadWrite:
      receives and forwards read and write requests (automatic read-write splitting).ReadOnly:
      receives and forwards only read requests.Default value: ReadOnly.'
    AllowedValues:
    - ReadOnly
    - ReadWrite
  EndpointConfig:
    Type: Json
    Description: ''
  AutoAddNewNodes:
    Default: Disable
    Type: String
    Description: |-
      Specifies whether a newly added node is automatically added to this connection point.
      Valid values: Enable, Disable.
      Default value: Disable.
    AllowedValues:
    - Disable
    - Enable
  Nodes:
    MinLength: 2
    Type: CommaDelimitedList
    Description: |-
      The nodes to be added to this connection point to process read requests from this connection point. Add at least two nodes.
      If you do not specify this parameter, all nodes of the cluster are added to this connection point by default.
  EndpointType:
    Default: Custom
    Type: String
    Description: The type of the cluster connection point. Set this parameter to Custom.
Outputs:
  DBEndpointId:
    Description: DB cluster endpoint ID. E.g. pe-xxxxxxxx.
    Value:
      Fn::GetAtt:
      - DBClusterEndpoint
      - DBEndpointId
  ConnectionString:
    Description: The first connection string of the db cluster endpoint.
    Value:
      Fn::GetAtt:
      - DBClusterEndpoint
      - ConnectionString
  Addresses:
    Description: The address items of the db cluster endpoint.
    Value:
      Fn::GetAtt:
      - DBClusterEndpoint
      - Addresses

JSON格式

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Resources": {
    "DBClusterEndpoint": {
      "Type": "ALIYUN::POLARDB::DBClusterEndpoint",
      "Properties": {
        "DBClusterId": {
          "Ref": "DBClusterId"
        },
        "ReadWriteMode": {
          "Ref": "ReadWriteMode"
        },
        "EndpointConfig": {
          "Ref": "EndpointConfig"
        },
        "AutoAddNewNodes": {
          "Ref": "AutoAddNewNodes"
        },
        "Nodes": {
          "Fn::Split": [
            ",",
            {
              "Ref": "Nodes"
            }
          ]
        },
        "EndpointType": {
          "Ref": "EndpointType"
        }
      }
    }
  },
  "Parameters": {
    "DBClusterId": {
      "Type": "String",
      "Description": "The ID of the ApsaraDB for POLARDB cluster for which a custom connection point is to be created."
    },
    "ReadWriteMode": {
      "Default": "ReadOnly",
      "Type": "String",
      "Description": "The read/write mode of the cluster connection point. Valid values: ReadWrite: receives and forwards read and write requests (automatic read-write splitting). ReadOnly: receives and forwards only read requests. Default value: ReadOnly.",
      "AllowedValues": [
        "ReadOnly",
        "ReadWrite"
      ]
    },
    "EndpointConfig": {
      "Type": "Json",
      "Description": ""
    },
    "AutoAddNewNodes": {
      "Default": "Disable",
      "Type": "String",
      "Description": "Specifies whether a newly added node is automatically added to this connection point.\nValid values: Enable, Disable.\nDefault value: Disable.",
      "AllowedValues": [
        "Disable",
        "Enable"
      ]
    },
    "Nodes": {
      "MinLength": 2,
      "Type": "CommaDelimitedList",
      "Description": "The nodes to be added to this connection point to process read requests from this connection point. Add at least two nodes.\nIf you do not specify this parameter, all nodes of the cluster are added to this connection point by default."
    },
    "EndpointType": {
      "Default": "Custom",
      "Type": "String",
      "Description": "The type of the cluster connection point. Set this parameter to Custom."
    }
  },
  "Outputs": {
    "DBEndpointId": {
      "Description": "DB cluster endpoint ID. E.g. pe-xxxxxxxx.",
      "Value": {
        "Fn::GetAtt": [
          "DBClusterEndpoint",
          "DBEndpointId"
        ]
      }
    },
    "ConnectionString": {
      "Description": "The first connection string of the db cluster endpoint.",
      "Value": {
        "Fn::GetAtt": [
          "DBClusterEndpoint",
          "ConnectionString"
        ]
      }
    },
    "Addresses": {
      "Description": "The address items of the db cluster endpoint.",
      "Value": {
        "Fn::GetAtt": [
          "DBClusterEndpoint",
          "Addresses"
        ]
      }
    }
  }
}