All Products
Search
Document Center

PolarDB:CreateDBClusterEndpoint

Last Updated:Mar 01, 2024

Creates a custom cluster endpoint for a PolarDB cluster.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
polardb:CreateDBClusterEndpointWRITE
  • dbcluster
    acs:polardb:{#regionId}:{#accountId}:dbcluster/{#dbclusterId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
DBClusterIdstringYes

The ID of cluster.

pc-**************
EndpointTypestringYes

The type of the cluster endpoint. Set the value to Custom.

Custom
NodesstringNo

The reader nodes that you want to associate with the endpoint. If you want to specify multiple reader nodes, separate the reader nodes with commas (,). If you do not specify this parameter, all nodes are used.

Note
  • You need to specify the node IDs for a PolarDB for MySQL cluster.
  • You need to specify the role name of each node for a PolarDB for PostgreSQL cluster or a PolarDB for PostgreSQL (Compatible with Oracle) cluster. Example: Writer, Reader1, Reader2.
  • If you set ReadWriteMode to ReadOnly, you can associate only one node with the endpoint. If the only node becomes faulty, the cluster endpoint may be unavailable for up to 1 hour. We recommend that you associate more than one node with the cluster endpoint in production environments. We recommend that you associate at least two nodes with the cluster endpoint to improve service availability.
  • If you set ReadWriteMode to ReadWrite, you need to associate at least two nodes with the cluster endpoint.
  • PolarDB for MySQL does not impose a limit on the types of the two nodes. If the nodes are read-only nodes, write requests are forwarded to the primary node.
  • PolarDB for PostgreSQL and PolarDB for PostgreSQL (compatible with Oracle) require a primary node.
  • pi-**********,pi-*********
    ReadWriteModestringNo

    The read/write mode. Valid values:

    • ReadWrite: receives and forwards read and write requests. Automatic read/write splitting is enabled.
    • ReadOnly: The account has the read-only permissions on the database.

    Default value: ReadOnly.

    ReadOnly
    AutoAddNewNodesstringNo

    Specifies whether to automatically associate newly added nodes with the cluster endpoint. Valid values:

    • Enable: Newly added nodes are automatically associated with the cluster endpoint.
    • Disable: Newly added nodes are not automatically associated with the cluster endpoint.

    Default value: Disable.

    Disable
    EndpointConfigstringNo

    The advanced configurations of the cluster endpoint. You must specify the configurations in the JSON format. You can specify the configurations of the following attributes: consistency level, transaction splitting, connection pool, and offload reads from the primary node.

    • Specify the consistency level in the format of {"ConsistLevel":"Consistency level"}. Default value: 1. Valid values:

      • 0: eventual consistency.
      • 1: session consistency.
      • 2: global consistency.
    • Specify the transaction splitting feature in the format of {"DistributedTransaction":"Transaction splitting"}. Valid values:

      • on: enables the transaction splitting feature. By default, the feature is enabled.
      • off: disables the transaction splitting feature.
    • Specify the offload reads from the primary node feature in the format of {"MasterAcceptReads":"Offload reads from the primary node"}. Default value: off. Valid values:

      • on: The primary node accepts read requests.
      • off: The primary node does not accept read requests.
    • Specify the connection pool in the format of {"ConnectionPersist":"Connection pool"}. Default value: off. Valid values:

      • off: disables the connection pool.
      • Session: enables the session-level connection pool.
      • Transaction: enables the transaction-level connection pool.
    Note
  • You can specify the transaction splitting, connection pool, and offload reads from the primary node features for a PolarDB for MySQL cluster only if ReadWriteMode is set to ReadWrite for the cluster endpoint.
  • Only PolarDB for MySQL supports global consistency.
  • If the ReadWriteMode parameter is set to ReadOnly, the consistency level must be 0.
  • You can use one record to specify the consistency level, transaction splitting, connection pool, and offload reads from the primary node features, such as {"ConsistLevel":"1","DistributedTransaction":"on","ConnectionPersist":"Session","MasterAcceptReads":"on"}.
  • The transaction splitting settings are restricted by the consistency level settings. For example, if you set the consistency level to 0, transaction splitting cannot be enabled. If you set the consistency level to 1 or 2, transaction splitting can be enabled.
  • {"ConsistLevel": "1","DistributedTransaction": "on"}
    ClientTokenstringNo

    The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must make sure that it is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. The token is case-sensitive.

    6000170000591aed949d0f******************
    DBEndpointDescriptionstringNo

    The name of the custom cluster endpoint.

    test

    Response parameters

    ParameterTypeDescriptionExample
    object
    RequestIdstring

    The ID of the request.

    CD35F3-F3-44CA-AFFF-BAF869******

    Examples

    Sample success responses

    JSONformat

    {
      "RequestId": "CD35F3-F3-44CA-AFFF-BAF869******"
    }

    Error codes

    HTTP status codeError codeError messageDescription
    400ClusterEndpoint.StatusNotValidCluster endpoint status is not valid.The state of the cluster endpoint is invalid.
    400EndpointNum.ErrorEndpoint number error.The endpoint number is invalid.
    400LockTimeoutThe request processing has failed due to lock timeout.Failed to process the request due to a lock timeout.
    404EndpointConfig.InvalidEndpoint config is invalid.The advanced parameter of the cluster endpoint is invalid.
    404InvalidDBClusterId.NotFoundThe DBClusterId provided does not exist in our records.The specified DBClusterId parameter does not exist in the current record.
    404EndpointConfig.ConflictEndpoint config is invalid, CausalConsistRead should be session since node SCC mode enabled.Endpoint the configuration is invalid, the CausalConsistRead should be a session because global consistency (high performance mode) for the node is enabled.

    For a list of error codes, visit the Service error codes.

    Change history

    Change timeSummary of changesOperation
    2022-11-24The Error code has changedsee changesets
    Change itemChange content
    Error CodesThe Error code has changed.
      Error Codes 400 change
      delete Error Codes: 404
    2022-09-28The Error code has changedsee changesets
    Change itemChange content
    Error CodesThe Error code has changed.
      Error Codes 404 change
      delete Error Codes: 400
    2022-07-13The Error code has changedsee changesets
    Change itemChange content
    Error CodesThe Error code has changed.
      Error Codes 404 change
      delete Error Codes: 400
    2022-04-25The Error code has changedsee changesets
    Change itemChange content
    Error CodesThe Error code has changed.
      delete Error Codes: 404
      Added Error Codes: 400