All Products
Search
Document Center

Implement switchover for origin IP addresses by using GTM

Last Updated: Sep 11, 2020

Scenarios

Customers in the fields of websites, games, videos, and live streaming can connect enterprise applications to Alibaba Cloud CDN to accelerate access to origin server content. These customers usually require high business availability, but Alibaba Cloud CDN does not perceive the running statuses of the origin IP addresses, which makes it impossible to switch user traffic to normal addresses upon disasters. Global Traffic Manager (GTM) can help enterprises achieve traffic load balancing, access acceleration, and switchover.

Solutions

Both Alibaba Cloud CDN and GTM use canonical domain names to provide corresponding services. If you specify the same subdomain name for different canonical domain names, Authoritative Domain Name System (DNS) servers respond to the requests in round-robin mode. As a result, one of the two products is unavailable. However, the business scenarios of many enterprises require both domain name acceleration and high availability of origin servers. Therefore, we recommend that Alibaba Cloud CDN and GTM be implemented in a serial way.

Schematic diagram

11

Configuration method

Steps

1 . Perform GTM configuration

2 . Configure Alibaba Cloud CDN for acceleration

3 . Verify the result

Prepare resources

1 . Prepare a test domain name: test.alidns.com.

2 . Create a GTM instance.

3 . Activate Alibaba Cloud CDN.

Configuration method

1. Perform GTM configuration

Log on to the Alibaba Cloud DNS console. In the left-side navigation pane, click Global Traffic Manager.

1 . Global settings

2231

2 . Address pool configurations

Create two address pools.

Address Pool Name

Address

Mode

test1

1.1.1.148

Smart Return

test2

2.2.2.79

Smart Return

Create an address pool and turn on Health Check.

112333211

123

33331

3 . Access policy configurations

Create an access policy.

Policy Name

Default Address Pool

Alternative Address Pool

DNS Request Sources

Global default policy

test1

test2

Global

11233

2. Configure Alibaba Cloud CDN for acceleration

(1) . On the Global Settings tab, click Click to Copy next to CNAME Access Domain Name.

11123

(2) . Log on to the Alibaba Cloud CDN console. In the left-side navigation pane, click Domain Names. On the Domain Names page, click Add Domain Name. Set Domain Name to Accelerate, set Origin Info to Site Domain, and then set Domain Name.

123312331

3 . After a domain name is created, it is initially in the Under Review and Configuring states. Wait a few minutes until it is in the Enabled state. Then, go to the Alibaba Cloud DNS console and configure the resolution records of the canonical domain name.

12311112231

4 . After you add a record, the Domain Names page appears. You can see that the CNAME record has been configured and the resolution has taken effect. For more information, see Check whether the DNS records take effect.

1123333123

3. Verification

Create NGINX on the preceding two address pools and modify test1 and test2 in the index.html file.

1 . Expected result: When both the test1 and test2 address pools are normal, the test1 address pool is used as the active GTM address pool and also used to process the Alibaba Cloud CDN back-to-origin requests.

Item

test1

test2

Health check status

Available

Available

Active GTM address pool

N/A

Alibaba Cloud CDN back-to-origin request

N/A

Verification:

(1) On the Address Pool Configurations tab of GTM, verify that both address pools are available.

122333

(2) On the Access Policy tab of GTM, verify that the active GTM address pool is test1.

11233123

(3) Test the Alibaba Cloud CDN back-to-origin requests: When you access the domain name in the browser and both the test1 and test2 address pools are available, the back-to-origin requests are sent to the server in the test1 address pool.

11122

Result: Both the test1 and test2 address pools are available. The active GTM address pool is test1 and the Alibaba Cloud CDN back-to-origin requests are sent to the server in the test1 address pool. 2 . Expected result: When the test1 address pool is unavailable and test2 is available, GTM switches access traffic to test2, and the Alibaba Cloud CDN back-to-origin requests are sent to the server in test2.

N/A

test1

test2

Health check status

Unavailable

Available

Active GTM address pool

N/A

Alibaba Cloud CDN back-to-origin request

N/A

Verification:

(1) On the Address Pool Configurations tab of GTM, check the address pool status: The test1 address pool is unavailable.

12231

(2) On the Alert Logs tab of GTM, check that the test1 address pool is unavailable and that traffic is switched to test2.

(3) On the Access Policy tab of GTM, verify that the active GTM address pool is test2.

1231

(4) Test the Alibaba Cloud CDN back-to-origin requests: When you access the domain name in the browser and the test1 address pool is unavailable, GTM switches traffic from test1 to test2. As a result, the Alibaba Cloud CDN back-to-origin requests are sent to the server in test2.

222313

Result: When the default address pool test1 is unavailable, the active GTM address pool is test2 and the Alibaba Cloud CDN back-to-origin requests are sent to the server in test2. 3 . Expected result: When the default address pool test1 becomes available and the alternative address pool test2 becomes unavailable, GTM switches traffic from test2 to test1. Meanwhile, an alert is triggered for the unavailable test2 address pool.

N/A

test1

test2

Health check status

Available

Unavailable

Active GTM address pool

N/A

Alibaba Cloud CDN back-to-origin request

N/A

Verification:

(1) On the Address Pool Configurations tab of GTM, check the address pool status: The test2 address pool is unavailable.

1112233

(2) On the Alert Logs tab of GTM, the test1 address pool is restored and traffic is switched to test1. However, test2 is unavailable and an alert is triggered

(3) On the Access Policy tab of GTM, verify that the active GTM address pool is test1.

1223313

(4) Test the Alibaba Cloud CDN back-to-origin requests: When you access the domain name in the browser and the test1 address pool is restored, GTM switches traffic from test2 to test1. Meanwhile, the Alibaba Cloud CDN back-to-origin requests are sent to the server in test1.

Result: When the default address pool test1 is restored, the active GTM address pool is test1 and the Alibaba Cloud CDN back-to-origin requests are sent to the server in test1.