You need to enable JavaScript to run this app.
导航
CreateDBEndpoint
最近更新时间:2025.02.21 09:58:00首次发布时间:2023.02.02 17:41:21
我的收藏
有用
有用
无用
无用

调用 CreateDBEndpoint 接口创建 Endpoint。

请求类型

异步请求。

调试

请求参数

参数
类型
是否必选
示例值
描述
InstanceId
String
mysql-e26822cf****
实例 ID。
EndpointType
String
Custom
连接终端类型。取值为 Custom,自定义终端。
ReadWriteMode
String
ReadOnly

连接终端的读写模式。取值:

  • ReadWrite:读写。
  • ReadOnly:只读。

说明

该参数作为请求参数时,默认值为 ReadWrite

EndpointName
String
EndpointName

实例连接终端名称。

  • 不能以数字、中划线(-)开头。
  • 只能包含中文、字母、数字、下划线(_)和中划线(-)。
  • 长度需要在1~64个字符内。
Description
String
这是一段连接终端的备注信息。
备注。
Nodes
String
Primary,mysql-3c25f219****-r5b3f

连接终端配置的节点 ID 列表。
当 EndpointType 为 Custom 时必选。

说明

  • 如需将主节点加入终端,不需填写主节点 ID,只需填写 Primary。
  • 多个节点 ID 之间用英文逗号(,)分隔。
AutoAddNewNodes
Boolean
true

当终端类型为读写终端或只读终端时,支持设置新节点是否自动加入。取值:

  • true:自动加入。
  • false:不自动加入(默认)。
ConnectionMode
String
Proxy

连接终端类型。取值:

  • Proxy:代理终端。
  • Direct:直连终端。

说明

  • 如实例的数据库代理功能已开启,可以取值为 ProxyDirect
  • 如实例的数据库代理功能未开启,仅可以取值为 Direct

可调用 DescribeDBInstanceDetail 接口查询实例数据库代理功能的开启状态。

IdleConnectionReclaim
Boolean
true

是否开启代理终端的空闲连接回收功能。取值:

  • true:是。
  • false:否。默认值。
ConnectionPoolType
String
Direct

代理终端的连接池类型。取值:

  • Transaction:事务级连接池。默认值。
  • Direct:直连模式。
ReadWriteSpliting
Boolean
true

是否开启读写分离。取值:

  • true:是。默认值。
  • false:否。
ReadOnlyNodeDistributionType
String
LoadSchedule

读权重分配模式。当开通读写分离设置为 true 时需要传入此参数。在 CreateDBEndpoint 和 ModifyDBEndpoint 接口中做请求参数时,取值范围如下:

  • LoadSchedule:负载调度。
  • RoundRobinCustom:自定义权重的轮询调度。
  • RoundRobinAuto:自动分配权重的轮询调度。

在 DescribeDBInstanceDetail 接口中做返回参数时,取值范围如下:

  • Default:按规格权重自动分配。
  • Custom:自定义分配权重。
  • RoundRobin:轮询调度。
  • LoadSchedule:负载调度。
  • RoundRobinCustom:自定义权重的轮询调度。
  • RoundRobinAuto:自动分配权重的轮询调度。
ReadOnlyNodeWeight
Object[]
请参见请求示例。
自定义读权重分配策略。
ReadOnlyNodeMaxDelayTime
Integer
40
只读节点延迟阈值。取值范围为 1~3600,默认为 30,单位为秒。
MultiStatementsMode
String
Loose

代理终端的 Multi-Statements 模式。取值:

  • Strict:Strict 模式。默认值。
  • Loose:Loose 模式。

返回参数

参数
类型
示例值
描述
InstanceId
String
mysql-3c25f219****
实例 ID。
EndpointId
String
mysql-3c25f219****-custom-eeb5
终端 ID。

示例

请求示例

POST /?Action=CreateDBEndpoint&Version=2022-01-01 HTTP/1.1
Content-Type: application/json
Host: rds.volcengineapi.com
X-Date: 20211202T101010Z
Authorization: HMAC-SHA256 Credential=AKLTN2I0MmFiNzMxNWE5NDgzMzk4MmVjMTVkODlkZTZ****/20211202/cn-beijing/rds_mysql/request,SignedHeaders=x-date, Signature=71d31fc7bcf990142851c9833c5656391486cda0ae2e0b8ada733b7c6458****
{
    "InstanceId": "mysql-3c25f219****",
    "EndpointName": "自定义终端",
    "EndpointType": "Custom",
    "Nodes": "Primary",
    "ReadWriteMode": "ReadWrite",
    "AutoAddNewNodes": true
}

返回示例

{
    "ResponseMetadata": {
        "RequestId": "20230302225000051F23B8DD57341993BE",
        "Action": "CreateDBEndpoint",
        "Version": "2022-01-01",
        "Service": "rds_mysql",
        "Region": "cn-beijing"
    },
    "Result": {
        "EndpointId": "mysql-f23648f2****-custom-eeb5",
        "InstanceId": "mysql-f23648f2****"
    }
}

错误码

更多详情,请参见错误码