All Products
Search
Document Center

Alibaba Cloud DNS:Use GTM to implement active-active load balancing and disaster recovery

Last Updated:May 06, 2026

Scenarios

Assume that your application is deployed in two data centers, A and B. Each data center has a public IP address for incoming traffic. You want to distribute traffic between the two data centers according to a specific ratio during normal operations. If one data center fails, the system must detect the failure and remove its IP address from service. When the data center recovers, its IP address is automatically added back to resume load balancing.

Prerequisites

  • The domain name cloud-example.com is hosted on Alibaba Cloud DNS.

    Note

    If your service domain name is not hosted on Alibaba Cloud DNS and you need to use GTM, add a CNAME record at your current DNS provider. Point the record to the GTM CNAME.

  • You have purchased a GTM instance. If you have not purchased an instance, purchase one.

  • The desired traffic scheduling result is:

    Source of DNS query

    Application service endpoint

    Weight ratio

    Global default

    1.1.XX.XX, 2.2.XX.XX

    1:1

    Note

    Adjust the ratio as needed. A higher weight value means the domain name is resolved to the corresponding address more frequently.

Procedure

  1. Go to Alibaba Cloud DNS - Global Traffic Manager.

  2. On the Access Zone Name tab, click the Create Access Zone Name button.

  3. In the Select Scenario dialog box, select Multi-active Load Balancing.

  4. On the Create Access Zone Name page, click the access zone icon and select Basic Configuration. For more information, see Basic configuration.

  5. On the Basic Configuration page, configure the parameters and click Submit. For more information about how to configure an access zone, see Access domain configuration.

  6. On the Access Zone Name page, click the address pool icon and select Basic Configuration.image

  7. On the Access Domain page, click the address icon and select Basic Configuration. On the configuration page, add an address and configure its settings, such as a health check template. This example uses the TCP probe protocol to probe port 80 on the server. You can use this method to add an address and associate it with a health check template.

    Note

    If you have not created a health check template, click Add Health Check Template. For more information, see Health check templates.

    image

    Important

    This example shows the configuration procedure. If you see red or orange alerts during configuration, check the health status of the address immediately.

  8. You do not need to configure a load balancing policy. The scenario template automatically generates a policy.

    Note

    To adjust the weight ratio, click the weight value above the address pool.

    Important

    During testing, you may find that DNS resolution results do not always match the weight configuration. This is normal because weight-based scheduling is a coarse-grained method that applies to requests from local DNS servers. A local DNS server queries the authoritative DNS server (Alibaba Cloud DNS) only once during the Time-to-Live (TTL) period.

    For example, assume that users in Shanghai use localdnsA and users in Beijing use localdnsB. When localdnsA and localdnsB send query requests to GTM, GTM responds according to your weight policy. However, within the TTL period, all users on the same local DNS server receive the same resolution result.

  9. You can configure alert monitoring for the instance. For more information, see Alert configuration.

  10. On the Access Zone Name page, click the access zone icon and select Enable.image

  11. On the Confirm Enable Access Zone Name page, verify that the access zone name is correct and then click OK.

    Important
    • If a DNS record with the same name and type exists in Alibaba Cloud DNS, the system prioritizes the GTM policy for intelligent scheduling and resolution. This enables advanced features such as load balancing and failover.

    • If you disable or delete the GTM instance, the zone name is resolved by Alibaba Cloud DNS.