All Products
Search
Document Center

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

Last Updated:Jan 28, 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 managed by Alibaba Cloud DNS. The service domain name to be added to Global Traffic Manager (GTM) is www.cloud-example.com.

    Note

    If your service domain name is not managed by Alibaba Cloud DNS, add a CNAME record with your current DNS provider. Point the record to the GTM access domain name.

  • You have purchased a GTM instance. If you have not purchased an instance, you must first purchase a subscription instance.

  • 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 the Alibaba Cloud DNS - Global Traffic Manager console.

  2. On the Access Domain tab, click Create Access Domain.

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

  4. On the Create Access Domain page, click the access domain name icon and select Basic Configuration.

    image

  5. On the Basic Configuration page, configure the parameters and click Submit. For more information, see 1. Configure an access domain name.

  6. On the current 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 4. Probe templates.

    image

    Important

    This example demonstrates the configuration process. If you see red or orange alert metrics 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. Configure monitoring and alerting for the instance. For more information, see Alert configuration.

  10. On the Access Domain page, click the access domain name icon and select Enable.image

  11. After you confirm the operation in the dialog box, the Access Domain is enabled.

    Important
    • If a DNS record with the same name and type exists in the Alibaba Cloud DNS authoritative zone, the system prioritizes GTM policies for intelligent scheduling and resolution. This allows GTM to handle queries for that record type and implement advanced features such as load balancing or failover.

    • If you disable or delete the GTM domain name instance, the domain name is resolved using the Public Zone.