教程:使用流量管理器配置地理流量路由方法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.

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

  1. 在浏览器中,登录 Azure 门户From a browser, sign in to the Azure portal. 如果还没有帐户,可注册 1 个月期限的试用版If you don't already have an account, you can sign up for a one-month trial.

  2. 单击“创建资源” > “网络” > “全部查看” > “流量管理器配置文件” > “创建” 。Click Create a resource > Networking > See All > Traffic Manager profile > Create.

  3. 在“创建流量管理器配置文件” 中:In the Create Traffic Manager profile:

    1. 提供配置文件的名称。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.
    2. 选择“地理” 路由方法。Select the Geographic routing method.
    3. 选择要创建此配置文件的订阅。Select the subscription you want to create this profile under.
    4. 使用现有资源组,或创建新的资源组,以在其下放置此配置文件。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.
    5. 单击“创建” 后,将创建并全局部署流量管理器配置文件。After you click Create, your Traffic Manager profile is created and deployed globally.

    创建流量管理器配置文件

添加终结点Add endpoints

  1. 在门户的搜索栏中搜索已创建的流量管理器配置文件名称,并在显示结果后单击该结果。Search for the Traffic Manager profile name you created in the portal's search bar and click on the result when it is shown.

  2. 导航到“流量管理器”中的“设置” -> “终结点”。 Navigate to Settings -> Endpoints in Traffic Manager.

  3. 单击“添加” 以显示“添加终结点” 。Click Add to show the Add Endpoint.

  4. 单击“添加” ,在显示的“添加终结点” 中,如下所述完成输入:Click Add and in the Add endpoint that is displayed, complete as follows:

  5. 选择类型,具体取决于要添加的终结点的类型。Select Type depending upon the type of endpoint you are adding. 对于生产中使用的地理路由配置文件,我们强烈建议使用包含有多个终结点的子配置文件的嵌套终结点类型。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 details, see FAQs about geographic traffic routing methods.

  6. 提供要用于识别此终结点的名称Provide a Name by which you want to recognize this endpoint.

  7. 此页面中的某些字段取决于要添加的终结点的类型: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.
  8. 在“异地映射”部分中,使用下拉列表添加要从中将流量发送到此终结点的区域。In the Geo-mapping section, use the drop down to add the regions from where you want traffic to be sent to this endpoint. 必须至少添加一个区域,并且可以映射多个区域。You must add at least one region, and you can have multiple regions mapped.

  9. 对于要在此配置文件下添加的所有终结点重复此操作Repeat this for all endpoints you want to add under this profile

    添加流量管理器终结点

使用流量管理器配置文件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 click on the traffic manager profile in the results that the displayed.
  2. 单击“概览”。 Click Overview.
  3. “流量管理器配置文件” 会显示新建的流量管理器配置文件的 DNS 名称。The Traffic Manager profile displays the DNS name of your newly created Traffic Manager profile. 任意客户端(例如通过 Web 浏览器导航到此名称)均可使用此名称路由到根据路由类型确定的相应终结点。This 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,并确定该请求所源自的区域。In the case of geographic routing, Traffic Manager looks at the source IP of the incoming request and determines the region from which it is originating. 如果该区域映射到某个终结点,则流量将路由到该终结点。If that region is mapped to an endpoint, traffic is routed to there. 如果该区域未映射到终结点,则流量管理器将返回 NODATA 查询响应。If this region is not mapped to an endpoint, then Traffic Manager returns a NODATA query response.

后续步骤Next steps