教程:在流量管理器中配置优先级流量路由方法Tutorial: Configure priority traffic routing method in Traffic Manager

本教程介绍如何使用 Azure 流量管理器通过优先级路由方法将用户流量路由到特定终结点。This tutorial describes how to use Azure Traffic Manager to route user traffic to specific endpoints by using the priority routing method. 在此路由方法中,你将定义进入流量管理器配置文件配置的每个终结点的顺序。In this routing method, you'll define the order of each endpoint that goes into Traffic Manager profile configuration. 来自用户的流量将按照列出用户的顺序路由到终结点。Traffic from users will be routed to the endpoint in the order they're listed. 要配置服务故障转移时,此路由方法很有用。This method of routing is useful when you want to configure for service failover. 主要终结点的优先级编号为“1”,并将为所有传入请求提供服务。The primary endpoint gets a priority number of '1' and will service all incoming requests. 而低优先级终结点将充当备份。While endpoints of lower priority will act as backups.

本教程介绍如何执行下列操作:In this tutorial, you learn how to:

  • 创建具有优先级路由的流量管理器配置文件。Create a Traffic Manager profile with priority routing.
  • 添加终结点。Add endpoints.
  • 配置终结点的优先级。Configure priority of endpoints.
  • 使用流量管理器配置文件。Use the Traffic Manager profile.
  • 删除流量管理器配置文件。Delete Traffic Manager profile.

先决条件Prerequisites

如果没有 Azure 订阅,可在开始前创建一个试用订阅If you don't have an Azure subscription, create a Trial Subscription before you begin.

配置优先级流量路由方法To configure the priority traffic routing method

  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 ValueValue
    名称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 Priority.
    订阅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.
    名称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.
    优先级Priority 为此终结点提供一个优先级编号。Give a priority number for this endpoint. 最高优先级为 1。1 is the highest priority.
  4. 选择“添加”以添加终结点。Select Add to add the endpoint. 重复步骤 2 和 3,添加更多终结点。Repeat step 2 and 3 to add additional endpoints. 切记要设置相应的优先级编号。Remember to set the appropriate priority number.

    添加优先级为 1 的终结点

  5. 在“终结点”页面上,查看终结点的优先级顺序。On the Endpoints page, review the priority order for your endpoints. 如果选择了“优先级” 流量路由方法,则所选终结点的顺序很重要。When you select the Priority traffic routing method, the order of the selected endpoints matters. 验证终结点的优先级顺序。Verify the priority order of endpoints. 主终结点位于顶部。The primary endpoint is on top. 请仔细检查显示的顺序。Double-check on the order it's displayed. 所有请求均会路由到第一个终结点,如果流量管理器检测到其处于不正常状态,则流量会自动故障转移到下一终结点。All requests will be routed to the first endpoint and if Traffic Manager detects it be unhealthy, the traffic automatically fails over to the next endpoint.

    优先级终结点列表

  6. 若要更改终结点优先级顺序,请选择终结点,更改优先级值,然后选择“保存”以保存终结点设置。To change the endpoint priority order, select the endpoint, change the priority value, and select Save to save the endpoint settings.

使用流量管理器配置文件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 overview page 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. 此情况下,所有请求均会路由到第一个终结点,如果流量管理器检测到其处于不正常状态,则流量会自动故障转移到下一终结点。In this case, all requests get routed to the first endpoint and if Traffic Manager detects it be unhealthy, the traffic automatically fails over to the next endpoint.

    流量管理器 DNS 名称

  3. 流量管理器配置文件正常工作后,请在权威 DNS 服务器上编辑 DNS 记录,将公司域名指向流量管理器域名。Once your Traffic Manager profile is working, edit the DNS record on your authoritative DNS server to point your company domain name to the Traffic Manager domain name.

清理资源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 priority routing method, see: