PolarDB-O 云原生数据库 DescribeDBClusterEndpoints

By | 2021年4月22日

调用DescribeDBClusterEndpoints接口查询PolarDB集群的地址信息。

调试

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

请求参数

名称 类型 是否必选 示例值 描述
Action String DescribeDBClusterEndpoints

系统规定参数,取值为DescribeDBClusterEndpoints

DBClusterId String pc-*************

集群ID。

DBEndpointId String pe-*************

集群地址ID。

返回数据

名称 类型 示例值 描述
Items Array of DBEndpoint

集群地址详情。

AddressItems Array of Address

连接串信息。

ConnectionString String ********.rwlb.polardb-pg-public.rds.aliyuncs.com

连接串。

IPAddress String 192.***.***.***

IP地址。

NetType String Private

网络类型,取值范围如下:

  • Public:公网
  • Private:私网
  • Inner:私网(经典网络)

仅PolarDB MySQL集群支持私网(经典网络)类型。

Port String 1521

端口。

PrivateZoneConnectionString String ***.***.**.com

绑定的私有域名,

VPCId String vpc-***************

专有网络ID。

VSwitchId String vsw-************

虚拟交换机ID。

VpcInstanceId String pe-*************

VPC实例ID。

说明 仅PolarDB MySQL集群会返回该参数。

AutoAddNewNodes String Enable

新节点是否自动加入默认集群地址:

  • Enable
  • Disable
DBEndpointDescription String test

自定义集群地址名称。

说明 仅自定义集群地址支持该参数,主地址和默认集群地址不会返回该参数。

DBEndpointId String pe-*************

连接地址ID。

EndpointConfig String {\"DistributedTransaction\":\"off\",\"ConsistLevel\":\"0\",\"LoadBalanceStrategy\":\"load\",\"MasterAcceptReads\":\"on\"}

集群地址的高级配置。

  • DistributedTransaction:事务拆分状态,取值范围如下:
    • on:事务拆分已开启
    • off:事务拆分已关闭
  • ConsistLevel:会话一致性级别,取值范围如下:
    • 0:最终一致性
    • 1:会话一致性。
    • 2:全局一致性
  • LoadBalanceStrategy:负载均衡策略,基于负载的自动调度,取值固定为load
  • MasterAcceptReads:主库是否接受读,取值范围如下:
    • on:主库接受读
    • off:主库不接受读
EndpointType String Custom

集群地址类型:

  • Cluster:默认集群地址。
  • Primary:主地址。
  • Custom:自定义集群地址。
NodeWithRoles String Reader1

目标连接地址下各节点的角色名称,其中主节点为Writer;由于一个连接地址下可加入多个只读节点,因此每个只读节点的角色名称后会加上数字作为区分,如Reader1Reader2,以此类推。

说明 仅PolarDB PostgreSQL集群和PolarDB-O集群支持该参数。

Nodes String pi-***************,pi-***************

连接地址配置的节点列表。

ReadWriteMode String ReadOnly

读写模式:

  • ReadWrite:可读可写(自动读写分离)。
  • ReadOnly:只读。
RequestId String 2DC120BF-6EBA-4C63-BE99-B09F9E******

请求ID。

示例

请求示例

http(s)://polardb.aliyuncs.com/?Action=DescribeDBClusterEndpoints
&DBClusterId=pc-*************
&<公共请求参数>

正常返回示例

XML 格式

<DescribeDBClusterEndpointsResponse>
  <RequestId>2DC120BF-6EBA-4C63-BE99-B09F9E******</RequestId>
  <Items>
        <DBEndpointId>pe-*************</DBEndpointId>
        <NodeWithRoles>{"pi-*************":"Reader2","pi-*************":"Reader1"}</NodeWithRoles>
        <AutoAddNewNodes>Disable</AutoAddNewNodes>
        <EndpointType>Custom</EndpointType>
        <AddressItems>
              <VPCId>vpc-***************</VPCId>
              <Port>1521</Port>
              <VSwitchId>vsw-***************</VSwitchId>
              <ConnectionString>pe-*************.rwlb.polardb-pg-public.rds.aliyuncs.com</ConnectionString>
              <IPAddress>192.***.***.***</IPAddress>
              <NetType>Private</NetType>
        </AddressItems>
        <Nodes>pi-*************,pi-*************</Nodes>
        <ReadWriteMode>ReadOnly</ReadWriteMode>
        <EndpointConfig>{"DistributedTransaction":"off","ConsistLevel":"0","LoadBalanceStrategy":"load","MasterAcceptReads":"on"}</EndpointConfig>
        <DBEndpointDescription>test</DBEndpointDescription>
  </Items>
</DescribeDBClusterEndpointsResponse>

JSON 格式

{
	"RequestId": "2DC120BF-6EBA-4C63-BE99-B09F9E******",
	"Items": [
		{
			"DBEndpointId": "pe-*************",
			"NodeWithRoles": "{\"pi-*************\":\"Reader2\",\"pi-*************\":\"Reader1\"}",
			"AutoAddNewNodes": "Disable",
			"EndpointType": "Custom",
			"AddressItems": [
				{
					"VPCId": "vpc-***************",
					"Port": "1521",
					"VSwitchId": "vsw-***************",
					"ConnectionString": "pe-*************.rwlb.polardb-pg-public.rds.aliyuncs.com",
					"IPAddress": "192.***.***.***",
					"NetType": "Private"
				}
			],
			"Nodes": "pi-*************,pi-*************",
			"ReadWriteMode": "ReadOnly",
			"EndpointConfig": "{\"DistributedTransaction\":\"off\",\"ConsistLevel\":\"0\",\"LoadBalanceStrategy\":\"load\",\"MasterAcceptReads\":\"on\"}",
			"DBEndpointDescription": "test"
		}
	]
}

错误码

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

请关注公众号获取更多资料

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

Iconic One Theme | Powered by Wordpress