教程:使用流量管理器配置地理流量路由方法Tutorial: Configure the geographic traffic routing method using Traffic Manager

使用地理流量路由方法,可基于请求源自的地理位置将流量定向到特定终结点。The Geographic traffic routing method allows you to direct traffic to specific endpoints based on the geographic location where the requests originate. 本教程说明如何使用此路由方法创建流量管理器配置文件,并配置终结点以从特定地理区域接收流量。This tutorial shows you how to create a Traffic Manager profile with this routing method and configure the endpoints to receive traffic from specific geographies.

在本教程中,你将了解如何执行以下操作:In this tutorial, you learn how to:

  • 根据地理路由创建流量管理器配置文件。Create a Traffic Manager profile with geographic routing.
  • 配置嵌套终结点。Configure a Nested endpoint.
  • 使用流量管理器配置文件。Use the Traffic Manager profile.
  • 删除流量管理器配置文件。Delete Traffic Manager profile.

先决条件Prerequisites

创建流量管理器配置文件Create a Traffic Manager Profile

  1. 在浏览器中,登录 Azure 门户From a browser, sign in to the Azure portal.

  2. 选择左侧的“+ 创建资源”。Select + Create a resource on the left side. 搜索“流量管理器配置文件”,然后选择“创建” 。Search for Traffic Manager profile and select Create.

    创建流量管理器配置文件

  3. 在“创建流量管理器配置文件”页中,定义以下设置:In the Create Traffic Manager profile page define the following settings:

    设置Setting Value
    名称Name 提供配置文件的名称。Provide a name for your profile. 此名称在 trafficmanager.cn 区域中必须是唯一的。This name needs to be unique within the trafficmanager.cn zone. 若要访问流量管理器配置文件,请使用 DNS 名称 <profilename>.trafficmanager.cnTo access your Traffic Manager profile, you use the DNS name <profilename>.trafficmanager.cn.
    路由方法Routing method 选择“地理”。Select Geographic.
    订阅Subscription 选择订阅。Select your subscription.
    资源组Resource group 使用现有资源组,或创建新的资源组,以在其下放置此配置文件。Use an existing resource group or create a new resource group to place this profile under. 如果选择创建新的资源组,请使用“资源组位置” 下拉列表来指定资源组位置。If you choose to create a new resource group, use the Resource Group location dropdown to specify the location of the resource group. 此设置指的是资源组的位置,对全局部署的流量管理器配置文件没有影响。This setting refers to the location of the resource group, and has no impact on the Traffic Manager profile that's deployed globally.
  4. 选择“创建”以部署流量管理器配置文件。Select Create to deploy your Traffic Manager profile.

    创建“流量管理器配置文件”页

添加终结点Add endpoints

  1. 从列表中选择该流量管理器配置文件。Select the Traffic Manager profile from the list.

    流量管理器地理列表

  2. 选择“设置”下的“终结点”,然后选择“+ 添加”以添加新终结点。Select Endpoints under Settings and select + Add to add a new endpoint.

    添加终结点

  3. 选择或输入以下设置:Select or enter the following settings:

    设置Setting “值”Value
    类型Type 选择终结点类型。Select the endpoint type. 对于生产中使用的地理路由配置文件,我们强烈建议使用包含有多个终结点的子配置文件的嵌套终结点类型。For geographic routing profiles used in production, we strongly recommend using nested endpoint types containing a child profile with more than one endpoint. 有关详细信息,请参阅有关地理流量路由方法的常见问题解答For more information, see FAQs about geographic traffic routing methods.
    名称Name 为该终结点命名,用于标识它。Give a name to identify this endpoint.
    目标资源类型Target resource type 选择目标的资源类型。Select the resource type for the target.
    目标资源Target resource 从列表中选择资源。Select the resource from the list.

    备注

    此页面中的某些字段取决于要添加的终结点的类型:Certain fields on this page depend on the type of endpoint you are adding:

    1. 如果要添加 Azure 终结点,请根据要将流量定向到的资源选择 目标资源类型目标If you are adding an Azure endpoint, select the Target resource type and the Target based on the resource you want to direct traffic to
    2. 如果要添加 外部 终结点,请为终结点提供 完全限定域名(FQDN)If you are adding an External endpoint, provide the Fully-qualified domain name (FQDN) for your endpoint.
    3. 如果要添加 嵌套终结点,请选择与要使用的子配置文件对应的 目标资源,并指定 最小子终结点计数If you are adding a Nested endpoint, select the Target resource that corresponds to the child profile you want to use and specify the Minimum child endpoints count.
  4. 在“异地映射”部分中,使用下拉列表添加要从中将流量发送到此终结点的区域。In the Geo-mapping section, use the drop-down to add the regions from where you want traffic to be sent to this endpoint. 必须至少添加一个区域。At least one region must be added. 可以映射多个区域。You can have multiple regions mapped.

  5. 对于要在此配置文件下添加的所有终结点重复最后一个步骤,然后选择“保存”。Repeat the last step for all endpoints you want to add under this profile and then select Save.

    添加流量管理器终结点

使用流量管理器配置文件Use the Traffic Manager profile

  1. 在门户的搜索栏中,搜索在前面部分中创建的流量管理器配置文件名称,然后在显示的结果中选择该流量管理器配置文件。In the portal's search bar, search for the Traffic Manager profile name that you created in the preceding section and select on the traffic manager profile in the results that the displayed.

    搜索流量管理器配置文件

  2. “流量管理器配置文件” 会显示新建的流量管理器配置文件的 DNS 名称。The Traffic Manager profile displays the DNS name of your newly created Traffic Manager profile. 任何客户端(例如,通过使用 Web 浏览器导航到客户端)均可使用此名称来路由到由路由类型确定的相应终结点。The name can be used by any clients (for example, by navigating to it using a web browser) to get routed to the right endpoint as determined by the routing type. 通过地理路由,流量管理器可查看传入请求的源 IP,并确定该请求所源自的区域。With geographic routing, Traffic Manager looks at the source IP of the incoming request and determines the region from which it's originating. 如果该区域映射到某个终结点,则流量将路由到该终结点。If that region is mapped to an endpoint, traffic is routed to there. 如果该区域未映射到终结点,则流量管理器将返回“无数据”查询响应。If this region isn't mapped to an endpoint, then Traffic Manager returns a NODATA query response.

    地理流量管理器概述

清理资源Clean up resources

如果不再需要流量管理器配置文件,请找到该配置文件,然后选择“删除配置文件”。If you not longer need the Traffic Manager profile, locate the profile and select Delete profile.

删除流量管理器配置文件

后续步骤Next steps

若要了解有关地理路由方法的详细信息,请参阅:To learn more about geographic routing method, see: