To connect to a PolarDB cluster, enter an endpoint of the PolarDB cluster. PolarDB supports cluster endpoints and primary endpoints. For each type of endpoints, you can apply for an internal endpoint or a public endpoint to connect to the cluster. This topic describes how to view or apply for an endpoint in the PolarDB console.

Cluster endpoint and primary endpoint

Endpoints
EndpointDescriptionNetwork type
Cluster endpoint (recommended)
  • An application can connect to multiple nodes by connecting to one cluster endpoint.
  • Cluster endpoints support read/write splitting. Write requests are forwarded to the primary node. Read requests are forwarded to the primary node or read-only nodes based on the load on each node.
Note A PolarDB cluster provides a default cluster endpoint. You can create one or more custom cluster endpoints based on your needs. When you create a custom cluster endpoint, you can specify the nodes that can be connected by using the endpoint and set the read/write mode. For more information, see Create a custom cluster endpoint.
  • Internal network
  • Internet
Primary endpoint
  • A primary endpoint allows you to connect to the primary node of the cluster. The endpoint can be used for read and write operations.
  • If the primary node fails, the primary endpoint is resolved to the new primary node.

Internal endpoint and public endpoint

Network typeDescriptionScenario
Internal network
  • A PolarDB cluster achieves optimal performance when the cluster is connected through an internal endpoint.
  • When you create a cluster, a default internal endpoint is generated. You can modify the endpoint but cannot delete it. For more information, see Modify an endpoint.

Examples:

  • If your Elastic Compute Service (ECS) instance runs in the same virtual private cloud (VPC) as the cluster, your ECS instance can connect to the cluster by using the internal endpoint.
  • You can connect to your cluster by using Data Management (DMS).
Internet
  • You can apply for or delete a public endpoint. For more information, see Apply for an endpoint and Delete an endpoint.
  • The public endpoint enables connections over the Internet. A PolarDB cluster cannot achieve optimal performance when the cluster is connected through a public endpoint.
Example: You can connect to your PolarDB cluster through a public endpoint to maintain databases.

View endpoints and ports

  1. Log on to the PolarDB console.
  2. In the upper-left corner of the console, select the region in which the cluster that you want to manage is deployed.
  3. Find the cluster and click the cluster ID.
  4. In the Endpoints section of the Overview page, view the endpoint and port information by using one of the following methods:
    • Method 1

      In the upper-right corner of the Endpoints section, click the Switch icon icon to switch views to view the endpoint and port information.

      E
    • Method 2

      Click Modify on the right of the cluster endpoint. In the dialog box that appears, view Network Information that includes the endpoint and the port number.

      2
    Note
    • If you use a domain name to connect to a database, you can click Bind Private Domain to bind the domain name to an internal endpoint. This allows you to retain the original database domain name after the database is migrated to the cloud. You can bind private domain names only to VPC-facing Endpoint endpoints. For more information, see Private domain names.
    • By default, a cluster includes port 1521 in its endpoint. You cannot modify the port.

Apply for an endpoint

  1. Log on to the PolarDB console.
  2. In the upper-left corner of the console, select the region in which the cluster that you want to manage is deployed.
  3. Find the cluster and click the cluster ID.
  4. In the Endpoints section of the Overview page, view the endpoint and port information by using one of the following methods:
  5. Click Apply.
    • Method 1
      1. In the upper-right corner of the Endpoints section, click the Switch icon icon to switch views.
      2. Click Apply. 2
    • Method 2
      1. Click Modify on the right of the cluster endpoint.
      2. In the Network Information section of the dialog box that appears, click Apply. 2
    Note
    • You can apply only for Public-facing Endpoint endpoints.
    • When you create a cluster, a default VPC-facing Endpoint endpoint is generated. You do not need to apply for this endpoint.
  6. In the dialog box that appears, specify a prefix for the endpoint and click OK.
    Note The prefix of the endpoint must meet the following requirements:
    • The prefix must be 6 to 30 characters in length, and can contain lowercase letters, digits, and hyphens (-).
    • The prefix must start with a letter and end with a digit or a letter.

What to do next

Connect to a cluster

Related API operations

APIDescription
DescribeDBClusterEndpointsQueries the endpoint of a specified PolarDB cluster.
CreateDBEndpointAddressCreates a public endpoint for a specified PolarDB cluster.
ModifyDBEndpointAddressModifies the default endpoint of a specified PolarDB cluster.
DeleteDBEndpointAddressDeletes a cluster endpoint of a specified PolarDB cluster.