All Products
Search
Document Center

PolarDB:Create a global domain name

Last Updated:Nov 04, 2025

When your business applications are distributed across multiple regions, managing and switching between the endpoints of various PolarDB clusters can be complex and error-prone. The global domain name feature of a Global Database Network (GDN) solves this by providing a single, unified, cross-region cluster endpoint. Your applications can use this global domain name to connect to the nearest cluster, regardless of which region the applications are deployed in. If the primary cluster experiences a failure, applications automatically reconnect to the new primary cluster. This simplifies your multi-region architecture and provides seamless, application-aware disaster recovery.

How it works

The global domain name feature uses the Private Hosted Zone service to provide intelligent DNS resolution within your virtual private cloud (VPC).

  • Mechanism: When you enable the global domain name feature, the system automatically creates a domain name in the format [gdnid].gdn.rds.aliyuncs.com. This domain name is then associated with the VPCs of all clusters in the GDN.

  • Example of a primary/secondary switchover:

    • Normal primary/secondary switchover: The primary cluster in the Beijing region fails over, becoming a secondary cluster, and consequently the secondary cluster in the Shanghai region is promoted to primary. Applications in the Beijing region connecting via the global domain name are still routed to the Beijing cluster endpoint for nearest-access. Read requests are served locally from the now-secondary Beijing cluster, while write requests are automatically routed to the new primary one in Shanghai.

    • Forced primary/secondary switchover: The global domain name configuration is updated synchronously to ensure that you can still access the new primary cluster. For example, when the original primary cluster is removed from the GDN and the new primary cluster is in Shanghai, applications in the Beijing region that connect to the global domain name are automatically routed to the Shanghai cluster endpoint through cross-VPC access. In this case, all requests, both read and write, are routed to the new primary cluster in Shanghai.

Important notes

  • After you enable the global domain name, if you switch the VPC and vSwitch of a cluster, you must re-establish network connectivity between the new VPC and the VPCs of other clusters in the GDN.

  • The global domain name provides traffic distribution only at the region level. If multiple clusters exist in the same region, service requests are randomly sent to any of the clusters.

Billing

Enabling and using the global domain name feature involves the following fees:

  • Private DNS resolution fees: The global domain name feature is based on Private Hosted Zone. For more information about billing, see Private Hosted Zone pricing.

  • Inter-region data transfer fees: After a forced primary/secondary switchover, if the original and new primary clusters are in different regions, you are charged for inter-region data transfer. This fee is charged by VPC Peering Connection. For more information about billing, see VPC Peering Connection billing.

Prerequisites: Configure network and permissions

Before you create a global domain name, complete the following preparations to ensure proper network connectivity and access permissions among the clusters in the GDN.

Important

The CIDR blocks of the VPCs where the GDN clusters are located must not overlap. If they do, ensure that the CIDR blocks of the vSwitches do not overlap.

  1. Activate the PrivateZone service: Log on to Alibaba Cloud DNS PrivateZone, and click the Add Zone button.

  2. Establish network connections between VPCs: Create a peering connection between each pair of VPCs that host clusters in the GDN. For example, if you have clusters in the Beijing, Shanghai, and Shenzhen regions, you must create three peering connections: Beijing-Shanghai, Beijing-Shenzhen, and Shanghai-Shenzhen. For more information, see VPC Peering Connection.

  3. Configure cluster whitelists: For each cluster in the GDN, add the CIDR blocks of the VPCs of all other clusters to its cluster whitelist.

Enable the global domain name

You can enable a global domain name when you create a GDN, or for an existing one.

  • When creating a GDN:

    1. Log on to the PolarDB console. In the navigation pane on the left, click Global Database Network.

    2. On the Global Database Network page, click Create GDN.

    3. In the Create Global Database Network (GDN) dialog box, turn on the Global Domain Name switch.

  • For an existing GDN:

    1. Log on to the PolarDB console. In the navigation pane on the left, click Global Database Network (GDN).

    2. On the Global Database Network (GDN) page, find the target GDN and click its Global Database Network ID to go to the GDN details page.

    3. Find Global Domain Name and click the Enable button on the right.

Note

When you enable this feature, the system automatically creates a service-linked role named AliyunServiceRoleForPolarDB. This role grants PolarDB the permissions to access other cloud resources, such as Private Hosted Zone.

Verify the global domain name

After configuration, verify the domain name resolution and connectivity from within the VPCs in each region.

  1. (Optional) Verify the VPC peering connection:

    For example, assume that the primary cluster is in the Beijing region and a secondary cluster is in the Shanghai region. On an ECS instance in the Beijing region, use a MySQL client to connect to the internal endpoint of the Shanghai cluster. If the connection is successful, the peering connection between the Beijing VPC and the Shanghai VPC is working as expected. Repeat the test from Shanghai to Beijing.

    mysql -hpc-xxxxxxxx.rwlb.rds.aliyuncs.com  -P3306 -uxxxx -pxxxx
  2. Verify nearest access: Confirm that the global domain name resolves to the local cluster endpoint within the VPC of each region.

    1. Log on to an ECS instance that is deployed in the same VPC as the primary cluster (for example, in the Beijing region).

    2. Run ping <global_domain_name> and ping <primary_cluster_internal_endpoint>.

    3. Expected result: The IP addresses returned by both commands are identical. This indicates that the global domain name resolves to the IP address of the nearest cluster.

    4. Use the same method to verify the secondary cluster.

  3. Verify failover (run a drill): Test whether applications can automatically connect to the new primary cluster through the global domain name after a primary/secondary switchover.

    1. Go to the details page of the target GDN. In the Clusters section, find the target secondary cluster. In the Actions column, click Switch To Primary Cluster. For more information, see Switch a secondary cluster to the primary cluster.

    2. After the switchover, reconnect to the global domain name and observe the recovery time.

Manage the global domain name

You can enable or disable the global domain name at any time as needed.

  1. Log on to the PolarDB console. In the navigation pane on the left, click Global Database Network (GDN).

  2. On the Global Database Network (GDN) page, find the target GDN and click its GDN ID to go to the GDN details page.

  3. Find Global Domain Name and click the Disable button on the right.

  4. Carefully read the notes in the dialog box. Then, click OK.

Note

You can re-enable the global domain name for the GDN at any time.