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.comis managed by Alibaba Cloud DNS. The service domain name to be added to Global Traffic Manager (GTM) iswww.cloud-example.com.NoteIf 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
NoteAdjust the ratio as needed. A higher weight value means the domain name is resolved to the corresponding address more frequently.
Procedure
Go to the Alibaba Cloud DNS - Global Traffic Manager console.
On the Access Domain tab, click Create Access Domain.
In the Select Scenario dialog box, select Multi-active Load Balancing.
On the Create Access Domain page, click the access domain name icon and select Basic Configuration.

On the Basic Configuration page, configure the parameters and click Submit. For more information, see 1. Configure an access domain name.
On the current page, click the address pool icon and select Basic Configuration.

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.
NoteIf you have not created a health check template, click Add Health Check Template. For more information, see 4. Probe templates.
ImportantThis example demonstrates the configuration process. If you see red or orange alert metrics during configuration, check the health status of the address immediately.
You do not need to configure a load balancing policy. The scenario template automatically generates a policy.
NoteTo adjust the weight ratio, click the weight value above the address pool.
ImportantDuring 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.
Configure monitoring and alerting for the instance. For more information, see Alert configuration.
On the Access Domain page, click the access domain name icon and select Enable.

After you confirm the operation in the dialog box, the Access Domain is enabled.
ImportantIf 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.