To connect to a PolarDB-O cluster, enter an endpoint of the PolarDB-O cluster. This topic describes how to view or apply for an endpoint in the PolarDB console.

Cluster endpoint and primary endpoint

Endpoints
Endpoint Description Network 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 through the endpoint and set the read/write mode. For more information, see Create a custom cluster endpoint for a PolarDB-O cluster.
  • 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 type Description Scenario
Internal network
  • A PolarDB cluster achieves optimal performance when the cluster is connected through an internal endpoint.
  • By default, an internal endpoint is generated when you create a cluster. You can modify the endpoint but cannot delete it. For more information, see Modify an endpoint.
  • 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 PolarDB-O 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.
You can connect to your database cluster through a public endpoint.

View endpoints and ports

  1. Log on to the PolarDB console.
  2. In the upper-left corner of the console, select the region where the cluster resides.
  3. Find the cluster, and then click the cluster ID.
  4. In the Endpoints section of the Overview page, click the The switch icon icon in the upper-right corner to switch views. Then, you can view the internal and public endpoints and ports.
    View endpoints
    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 to only VPC-facing Endpoint endpoints. For more information, see Private domain names.
    • By default, a PolarDB-O 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 where the cluster resides.
  3. Find the cluster, and then click the cluster ID.
  4. In the Endpoints section of the Overview page, click the The switch icon icon in the upper-right corner to switch views.
  5. Click Apply.
    Apply for a public endpoint
    Note
    • You can apply for only 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 letter.

Next

Connect to a database cluster

FAQ

Q: If my application uses a public-facing endpoint to connect to a PolarDB instance, will data usage fees be incurred?

A: Alibaba Cloud does not charge for the data usage during connections to PolarDB through a public-facing endpoint.

Related operations

API Description
DescribeDBClusterEndpoints Queries the endpoint of a cluster.
CreateDBEndpointAddress Creates a public endpoint for a cluster.
ModifyDBEndpointAddress Modifies the default endpoint of a cluster.
DeleteDBEndpointAddress Deletes an endpoint of a cluster.