教程:在流量管理器中配置加权流量路由方法Tutorial: Configure the weighted traffic routing method in Traffic Manager

一种常见的流量路由方法模式是提供一组相同的终结点(包括云服务和网站),并均匀地向每个终结点发送流量。A common traffic routing method pattern is to provide a set of identical endpoints, which include cloud services and websites, and send traffic to each equally. 以下步骤概述如何配置这种类型的流量路由方法。The following steps outline how to configure this type of traffic routing method.

备注

Azure Web 应用已经为 Azure 区域内的网站(可能包含多个数据中心)提供了循环负载均衡功能。Azure Web App already provides round-robin load balancing functionality for websites within an Azure Region (which may comprise multiple datacenters). 流量管理器允许你在不同数据中心的网站之间分配流量。Traffic Manager allows you to distribute traffic across websites in different datacenters.

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

  • 根据加权路由创建流量管理器配置文件。Create a Traffic Manager profile with weighted routing.
  • 使用流量管理器配置文件。Use the Traffic Manager profile.
  • 删除流量管理器配置文件。Delete Traffic Manager profile.

先决条件Prerequisites

配置加权流量路由方法Configure the weighted traffic routing method

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

  2. 在门户的搜索栏中,搜索在前面部分中创建的流量管理器配置文件名称,然后在显示的结果中选择该流量管理器配置文件。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.

    搜索流量管理器配置文件

  3. 选择“配置”。然后选择或输入以下设置:Select Configuration and select or enter the following settings:

    设置Setting “值”Value
    路由方法Routing method 选择“加权”。Select Weighted.
    DNS 生存时间 (TTL)DNS time to live (TTL) 该值控制客户端本地缓存名称服务器在流量管理器系统中查询已更新 DNS 条目的频率。This value controls how often the client's local caching name server will query the Traffic Manager system for updated DNS entries. 流量管理器中发生的任何更改(例如,流量路由方法更改或所添加的终结点的可用性更改)都需要经过这么长的时间才能在整个 DNS 服务器全局系统中刷新。Any change that occurs with Traffic Manager, such as traffic routing method changes or changes in the availability of added endpoints, will take this period of time to be refreshed throughout the global system of DNS servers.
    协议Protocol 选择用于监视终结点的协议。Select a protocol for endpoint monitoring. 选项:HTTP、HTTPS 和 TCPOptions: HTTP, HTTPS, and TCP
    端口Port 指定端口号。Specify the port number.
    路径Path 若要监视终结点,必须指定路径和文件名。To monitor endpoints, you must specify a path and filename. 正斜杠“/”是有效的相对路径条目,表示文件位于根目录(默认位置)中。A forward slash "/" is a valid entry for the relative path and implies that the file is in the root directory (default).
    自定义标头设置Custom Header settings 在 format host:contoso.com,newheader:newvalue 中配置自定义标头。Configure the Custom Headers in format host:contoso.com,newheader:newvalue. 支持的对数上限为 8。Maximum supported pair is 8. 适用于 Http 和 Https 协议。Applicable for Http and Https protocol. 适用于配置文件中的所有终结点Applicable for all endpoints in the profile
    预期状态代码范围(默认值:200)Expected Status Code Ranges (default: 200) 配置状态代码范围(采用 200-299,301-301 格式)。Configure the Status Code Ranges in format 200-299,301-301. 支持的最大范围为 8。Maximum supported range is 8. 适用于 Http 和 Https 协议。Applicable for Http and Https protocol. 适用于配置文件中的所有终结点Applicable for all endpoints in the profile
    探测间隔Probing interval 配置终结点运行状况探测之间的时间间隔。Configure the time interval between endpoint health probes. 你可以选择 10 秒或 30 秒。You can choose 10 or 30 seconds.
    容许的失败次数Tolerate number of failures 配置触发终结点失败之前容许的运行状况探测失败次数。Configure the number of health probe failures tolerated before an endpoint failure is triggered. 请输入介于 0 和 9 之间的数字。You can enter a number between 0 and 9.
    探测超时Probe timeout 配置终结点运行状况探测超时之前所需的时间。此值必须至少为 5 并且小于探测时间间隔值。Configure the time required before an endpoint health probe times out. This value must be at least 5 and smaller than the probing interval value.
  4. 选择“保存”,以完成配置。Select Save to complete the configuration.

    流量管理器加权配置

  5. 选择“终结点”并配置每个终结点的权重。Select Endpoint and configure the weight of each endpoint. 权重可以介于 1-1000 之间。Weight can be between 1-1000. 权重越高,优先级就越高。The higher the weight, the higher the priority.

    流量管理器加权终结点配置

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

“流量管理器配置文件” 会显示新建的流量管理器配置文件的 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. 在这种情况下,所有请求都以轮循机制的方式路由每个终结点。In this case, all requests are routed each endpoint in a round-robin fashion.

流量管理器加权概述

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