All Products
Search
Document Center

PolarDB:Create a global domain name

Last Updated:Mar 28, 2026

When your business applications are distributed across multiple regions, each primary/secondary switchover requires updating connection strings in every application. The global domain name feature of a Global Database Network (GDN) eliminates this by providing a single, stable endpoint across regions. Applications connect to the nearest cluster automatically and reconnect to the new primary after a switchover—without any connection string changes.

The global domain name uses the Private Hosted Zone service to provide intelligent DNS resolution within your virtual private cloud (VPC). When you enable the feature, the system creates a domain name in the format [gdnid].gdn.rds.aliyuncs.com and associates it with the VPCs of all clusters in the GDN.

How it works

Normal primary/secondary switchover

The primary cluster in the Beijing region fails over to secondary, and the Shanghai cluster is promoted to primary. Applications in the Beijing region that connect via the global domain name continue to be routed to the Beijing cluster endpoint for nearest access. Read requests are served locally from the Beijing cluster (now secondary), while write requests are automatically routed to the new primary in Shanghai.

Forced primary/secondary switchover

The global domain name configuration is updated synchronously. If the original primary cluster is removed from the GDN and the new primary is in Shanghai, applications in the Beijing region are routed to the Shanghai cluster endpoint through cross-VPC access. All requests—both read and write—go to the new primary in Shanghai.

Considerations

  • Region-level traffic distribution only. If multiple clusters exist in the same region, requests are distributed randomly among them. Traffic cannot be directed to a specific cluster within the same region.

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

Billing

Enabling the global domain name incurs the following fees:

Fee typeBasisReference
Private DNS resolutionBased on Private Hosted Zone usagePrivate Hosted Zone pricing
Inter-region data transferCharged by VPC Peering Connection after a forced switchover where the original and new primary clusters are in different regionsVPC Peering Connection billing

Prerequisites

Before you enable the global domain name, complete the following steps to establish network connectivity and access permissions across GDN clusters.

Important

The CIDR blocks of the VPCs hosting GDN clusters must not overlap. If they do, ensure that the vSwitch CIDR blocks do not overlap.

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

  2. Establish VPC peering connections. Create a peering connection between each pair of VPCs that host clusters in the GDN. For example, for clusters in Beijing, Shanghai, and Shenzhen, create three peering connections: Beijing–Shanghai, Beijing–Shenzhen, and Shanghai–Shenzhen. See VPC Peering Connection.

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

Enable the global domain name

Enable the global domain name either when creating a new GDN or for an existing one.

When creating a GDN:

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

  2. 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 left navigation pane, click Global Database Network (GDN).

  2. Find the target GDN and click its Global Database Network ID to open the GDN details page.

  3. Find Global Domain Name and click Enable.

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, including Private Hosted Zone.

Verify the global domain name

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

  1. (Optional) Verify the VPC peering connection. From an ECS instance in one region, use a MySQL client to connect to the internal endpoint of a cluster in another region. If the connection succeeds, the peering connection is working. Repeat the test in the other direction.

    mysql -hpc-xxxxxxxx.rwlb.rds.aliyuncs.com  -P3306 -uxxxx -pxxxx
  2. Verify nearest access. On an ECS instance deployed in the same VPC as the primary cluster, run the following commands and compare the returned IP addresses:

    ping <global_domain_name>
    ping <primary_cluster_internal_endpoint>

    The IP addresses must be identical. This confirms that the global domain name resolves to the nearest cluster. Repeat this verification from the VPC of each secondary cluster.

  3. Verify failover (run a drill).

    1. On the GDN details page, go to the Clusters section. Find the target secondary cluster and click Switch To Primary Cluster in the Actions column. See Switch a secondary cluster to the primary cluster.

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

Manage the global domain name

Disable or re-enable the global domain name at any time.

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

  2. Find the target GDN and click its GDN ID to open the GDN details page.

  3. Find Global Domain Name and click Disable.

  4. Read the notes in the dialog box, then click OK.

Note

To re-enable the global domain name, follow the same steps and click Enable instead of Disable.