All Products
Search
Document Center

PolarDB:CreateDBClusterEndpoint

Last Updated:Oct 18, 2024
This topic is generated by a machine translation engine without any human intervention. ALIBABA CLOUD DOES NOT GUARANTEE THE ACCURACY OF MACHINE TRANSLATED CONTENT. To request a human-translated version of this topic or provide feedback on this translation, please include it in the feedback form.

Creates a custom cluster endpoint for a PolarDB cluster.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

There is currently no authorization information disclosed in the API.

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 enable automatic association of newly added nodes with the cluster endpoint. Valid values:

    • Enable: enables automatic association of newly added nodes with the cluster endpoint.
    • Disable (default): disables automatic association of newly added nodes with the cluster endpoint.
    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
    SccModestringNo

    Whether the node has enabled the global consistency (high-performance mode) feature. The value range is as follows:

    • ON: Enabled - OFF: Disabled
    on
    PolarSccWaitTimeoutstringNo

    Global consistency timeout

    100
    PolarSccTimeoutActionstringNo

    Global consistency timeout strategy. The value range is as follows:

    • 0: Send the request to the primary node
    • 2: Timeout degradation, when a global consistency read times out, the query operation will automatically degrade to an inconsistent read, and the client will not receive an error message
    0

    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 maximum number of endpoints is exceeded.
    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
    2024-07-30The Error code has changed. The request parameters of the API has changedView Change Details
    2022-11-24The Error code has changedView Change Details
    2022-09-28The Error code has changedView Change Details
    2022-07-13The Error code has changedView Change Details
    2022-04-25The Error code has changedView Change Details