您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

嵌套式流量管理器配置文件Nested Traffic Manager profiles

流量管理器包含一系列流量路由方法,可用于控制流量管理器如何选择具体的终结点来从每个最终用户处接收流量。Traffic Manager includes a range of traffic-routing methods that allow you to control how Traffic Manager chooses which endpoint should receive traffic from each end user. 有关详细信息,请参阅流量管理器流量路由方法For more information, see Traffic Manager traffic-routing methods.

每个流量管理器配置文件都会指定一个流量路由方法。Each Traffic Manager profile specifies a single traffic-routing method. 但是,有些方案要求的流量路由复杂程度高于单个流量管理器配置文件所能提供的路由。However, there are scenarios that require more sophisticated traffic routing than the routing provided by a single Traffic Manager profile. 可以嵌套流量管理器配置文件以结合一种以上的流量路由方法的优势。You can nest Traffic Manager profiles to combine the benefits of more than one traffic-routing method. 使用嵌套式配置文件可以重写默认的流量管理器行为,支持更大、更复杂的应用程序部署。Nested profiles allow you to override the default Traffic Manager behavior to support larger and more complex application deployments.

以下示例演示如何在不同的方案中使用嵌套式流量管理器配置文件。The following examples illustrate how to use nested Traffic Manager profiles in various scenarios.

示例 1:组合使用“性能”和“加权”流量路由Example 1: Combining 'Performance' and 'Weighted' traffic routing

假设在以下 Azure 区域部署了一个应用程序:美国西部、西欧和东亚。Suppose that you deployed an application in the following Azure regions: West US, West Europe, and East Asia. 使用流量管理器的“性能”流量路由方法将流量分发到最靠近用户的区域。You use Traffic Manager's 'Performance' traffic-routing method to distribute traffic to the region closest to the user.

单个流量管理器配置文件

现在,假设要针对服务的某项更新进行测试,再推广该更新。Now, suppose you wish to test an update to your service before rolling it out more widely. 想要使用“加权”流量路由方法,以便将少部分流量定向到测试部署。You want to use the 'weighted' traffic-routing method to direct a small percentage of traffic to your test deployment. 在西欧设置了测试部署以及现有的生产部署。You set up the test deployment alongside the existing production deployment in West Europe.

无法在单个配置文件中结合使用“加权”和“性能”流量路由方法。You cannot combine both 'Weighted' and 'Performance traffic-routing in a single profile. 若要支持此方案,可以使用位于西欧的两个终结点和“加权”流量路由方法创建流量管理器配置文件。To support this scenario, you create a Traffic Manager profile using the two West Europe endpoints and the 'Weighted' traffic-routing method. 接下来,将此“子”配置文件作为终结点添加到“父”配置文件。Next, you add this 'child' profile as an endpoint to the 'parent' profile. 父配置文件仍使用“性能”流量路由方法,并且仍包含终结点形式的其他全局部署。The parent profile still uses the Performance traffic-routing method and contains the other global deployments as endpoints.

下图演示了此示例:The following diagram illustrates this example:

嵌套式流量管理器配置文件

在此配置中,通过父配置文件定向的流量可跨区域正常分发。In this configuration, traffic directed via the parent profile distributes traffic across regions normally. 在西欧,嵌套式配置文件根据分配的权重将流量分发到生产和测试终结点。Within West Europe, the nested profile distributes traffic to the production and test endpoints according to the weights assigned.

当父配置文件使用“性能”流量路由方法时,必须为每个终结点分配一个位置。When the parent profile uses the 'Performance' traffic-routing method, each endpoint must be assigned a location. 可在配置终结点时分配该位置。The location is assigned when you configure the endpoint. 请选择离部署最近的 Azure 区域。Choose the Azure region closest to your deployment. Azure 区域是 Internet 延迟表支持的位置值。The Azure regions are the location values supported by the Internet Latency Table. 有关详细信息,请参阅流量管理器“性能”流量路由方法For more information, see Traffic Manager 'Performance' traffic-routing method.

示例 2:嵌套式配置文件中的终结点监视Example 2: Endpoint monitoring in Nested Profiles

流量管理器会主动监视每个服务终结点的运行状况。Traffic Manager actively monitors the health of each service endpoint. 如果终结点不正常,流量管理器会将用户定向到替代终结点,保持服务的可用性。If an endpoint is unhealthy, Traffic Manager directs users to alternative endpoints to preserve the availability of your service. 这种终结点监视和故障转移行为适用于所有流量路由方法。This endpoint monitoring and failover behavior applies to all traffic-routing methods. 有关详细信息,请参阅流量管理器终结点监视For more information, see Traffic Manager Endpoint Monitoring. 终结点监视的工作方式不同于嵌套式配置文件。Endpoint monitoring works differently for nested profiles. 对于嵌套式配置文件,父配置文件不会针对子配置文件直接执行运行状况检查。With nested profiles, the parent profile doesn't perform health checks on the child directly. 子配置文件的终结点运行状况用于计算子配置文件的总体运行状况。Instead, the health of the child profile's endpoints is used to calculate the overall health of the child profile. 此运行状况信息会在嵌套式配置文件层次结构中向上传播。This health information is propagated up the nested profile hierarchy. 父配置文件使用聚合运行状况信息确定是否将流量定向到子配置文件。The parent profile uses this aggregated health to determine whether to direct traffic to the child profile. 有关嵌套式配置文件运行状况监视的完整详细信息,请参阅常见问题解答See the FAQ for full details on health monitoring of nested profiles.

回到前面的示例,假设西欧的生产部署发生故障。Returning to the previous example, suppose the production deployment in West Europe fails. 默认情况下,“子”配置文件会将所有流量定向到测试部署。By default, the 'child' profile directs all traffic to the test deployment. 如果测试部署也发生故障,父配置文件将确定子配置文件是否不应接收流量,因为所有子终结点都不正常。If the test deployment also fails, the parent profile determines that the child profile should not receive traffic since all child endpoints are unhealthy. 然后,父配置文件将流量分发到其他区域。Then, the parent profile distributes traffic to the other regions.

嵌套式配置文件故障转移(默认行为)

可能对这种流程感到满意。You might be happy with this arrangement. 或者,可能担心西欧的所有流量(而不是有限数量的流量)现在都会转到测试部署。Or you might be concerned that all traffic for West Europe is now going to the test deployment instead of a limited subset traffic. 不管测试部署的运行状况如何,都希望西欧的生产部署发生故障时,能够故障转移到其他区域。Regardless of the health of the test deployment, you want to fail over to the other regions when the production deployment in West Europe fails. 要启用这种故障转移,可以在将子配置文件配置为终结点时,在父配置文件中指定“MinChildEndpoints”参数。To enable this failover, you can specify the 'MinChildEndpoints' parameter when configuring the child profile as an endpoint in the parent profile. 该参数确定子配置文件中可用终结点的最小数目。The parameter determines the minimum number of available endpoints in the child profile. 默认值为“1”。The default value is '1'. 在本方案中,可将 MinChildEndpoints 值设置为 2。For this scenario, you set the MinChildEndpoints value to 2. 如果低于此阈值,父配置文件会将整个子配置文件视为不可用,并将流量定向到其他终结点。Below this threshold, the parent profile considers the entire child profile to be unavailable and directs traffic to the other endpoints.

下图演示了此配置:The following figure illustrates this configuration:

嵌套式配置文件故障转移,“MinChildEndpoints”设置为 2

备注

“优先级”流量路由方法将所有流量分发到单个终结点。The 'Priority' traffic-routing method distributes all traffic to a single endpoint. 因此,为子配置文件设置除“1”以外的 MinChildEndpoints 值几乎没有作用。Thus there is little purpose in a MinChildEndpoints setting other than '1' for a child profile.

示例 3:“性能”流量路由中的优先故障转移区域Example 3: Prioritized failover regions in 'Performance' traffic routing

“性能”流量路由方法的默认行为是,当终结点位于不同地理位置时,将依据最低网络延迟将最终用户路由到“最近”的终结点。The default behavior for the 'Performance' traffic-routing method is when you have endpoints in different geographic locations the end users are routed to the "closest" endpoint in terms of the lowest network latency.

但是,假设希望将西欧的流量故障转移到美国西部,仅当这两个终结点都不可用时才将流量定向到其他区域。However, suppose you prefer the West Europe traffic failover to West US, and only direct traffic to other regions when both endpoints are unavailable. 可以使用包含“优先级”流量路由方法的子配置文件创建此解决方案。You can create this solution using a child profile with the 'Priority' traffic-routing method.

首选故障转移的“性能”流量路由

由于西欧终结点的优先级高于美国西部终结点,因此当两个终结点都处于联机状态时,所有流量将发送到西欧终结点。Since the West Europe endpoint has higher priority than the West US endpoint, all traffic is sent to the West Europe endpoint when both endpoints are online. 如果西欧发生故障,则会将其流量定向到美国西部。If West Europe fails, its traffic is directed to West US. 如果使用嵌套式配置文件,则仅当西欧和美国西部都发生故障时,流量才定向到东亚。With the nested profile, traffic is directed to East Asia only when both West Europe and West US fail.

可以针对所有区域重复此模式。You can repeat this pattern for all regions. 将父配置文件中的所有三个终结点替换为三个子配置文件,每个子配置文件提供故障转移优先顺序。Replace all three endpoints in the parent profile with three child profiles, each providing a prioritized failover sequence.

示例 4:控制同一区域中多个终结点之间的“性能”流量路由Example 4: Controlling 'Performance' traffic routing between multiple endpoints in the same region

假设在配置文件中使用“性能”流量路由方法时,该配置文件在特定区域有多个终结点。Suppose the 'Performance' traffic-routing method is used in a profile that has more than one endpoint in a particular region. 默认情况下,定向到该区域的流量会平均分布到该区域的所有可用终结点。By default, traffic directed to that region is distributed evenly across all available endpoints in that region.

“性能”流量路由区域内流量分布(默认行为)

无需在西欧添加多个终结点,这些终结点会包含在单独的子配置文件中。Instead of adding multiple endpoints in West Europe, those endpoints are enclosed in a separate child profile. 子配置文件将作为西欧的唯一终结点添加到父配置文件。The child profile is added to the parent as the only endpoint in West Europe. 子配置文件中的设置可以通过在西欧启用基于优先级或加权的流量路由,控制西欧的流量分布。The settings on the child profile can control the traffic distribution with West Europe by enabling priority-based or weighted traffic routing within that region.

“性能”流量路由,自定义区域内流量分布

示例 5:基于终结点的监视设置Example 5: Per-endpoint monitoring settings

假设希望使用流量管理器来顺利地将流量从旧的本地网站迁移到基于云的新版网站(托管在 Azure 中)。Suppose you are using Traffic Manager to smoothly migrate traffic from a legacy on-premises web site to a new Cloud-based version hosted in Azure. 对于旧站点,想要使用主页 URI 监视站点运行状况。For the legacy site, you want to use the home page URI to monitor site health. 但对于基于云的新版站点,你要实现一个包含附加检查的自定义监视页面(路径为“/monitor.aspx”)。But for the new Cloud-based version, you are implementing a custom monitoring page (path '/monitor.aspx') that includes additional checks.

流量管理器终结点监视(默认行为)

流量管理器配置文件中的监视设置将应用到单个配置文件中的所有终结点。The monitoring settings in a Traffic Manager profile apply to all endpoints within a single profile. 使用嵌套式配置文件时,可为每个站点使用一个不同的子配置文件来定义不同的监视设置。With nested profiles, you use a different child profile per site to define different monitoring settings.

按终结点进行设置的流量管理器终结点监视

常见问题FAQs

后续步骤Next steps

深入了解流量管理器配置文件Learn more about Traffic Manager profiles

了解如何创建流量管理器配置文件Learn how to create a Traffic Manager profile