流量管理器终结点Traffic Manager endpoints

使用 Azure 流量管理器可以控制如何将网络流量分布到在不同数据中心运行的应用程序部署。Azure Traffic Manager allows you to control how network traffic is distributed to application deployments running in different datacenters. 需要在流量管理器中将每个应用程序部署配置为一个“终结点”。You configure each application deployment as an 'endpoint' in Traffic Manager. 当流量管理器收到 DNS 请求时,将选择要在 DNS 响应中返回的可用终结点。When Traffic Manager receives a DNS request, it chooses an available endpoint to return in the DNS response. 流量管理器根据当前终结点状态和流量路由方法做出这种选择。Traffic manager bases the choice on the current endpoint status and the traffic-routing method. 相关详细信息,请参阅流量管理器工作原理For more information, see How Traffic Manager Works.

流量管理器支持三种类型的终结点:There are three types of endpoint supported by Traffic Manager:

  • Azure 终结点用于在 Azure 中托管的服务。Azure endpoints are used for services hosted in Azure.
  • 外部终结点用于 IPv4/IPv6 地址、FQDN,或用于在 Azure 外部托管的服务,这些服务可以在本地托管或通过其他托管提供商进行托管。External endpoints are used for IPv4/IPv6 addresses, FQDNs, or for services hosted outside Azure that can either be on-premises or with a different hosting provider.
  • 嵌套终结点用于组合流量管理器配置文件,以便创建更灵活的流量路由方案,从而满足更大、更复杂部署的需求。Nested endpoints are used to combine Traffic Manager profiles to create more flexible traffic-routing schemes to support the needs of larger, more complex deployments.

可以不受限制地在单个流量管理器配置文件中通过各种方式组合不同类型的终结点。There is no restriction on how endpoints of different types are combined in a single Traffic Manager profile. 每个配置文件都可以包含任何组合形式的终结点类型。Each profile can contain any mix of endpoint types.

以下各节更进一步地描述了每个终结点类型。The following sections describe each endpoint type in greater depth.

Azure 终结点Azure endpoints

Azure 终结点用于流量管理器中基于 Azure 的服务。Azure endpoints are used for Azure-based services in Traffic Manager. 支持以下 Azure 资源类型:The following Azure resource types are supported:

  • PaaS 云服务。PaaS cloud services.
  • Web 应用Web Apps
  • Web 应用槽Web App Slots
  • PublicIPAddress 资源(可直接或通过 Azure 负载均衡器连接到 VM)。PublicIPAddress resources (which can be connected to VMs either directly or via an Azure Load Balancer). 必须为 publicIpAddress 分配一个 DNS 名称,才能在流量管理器配置文件中使用它。The publicIpAddress must have a DNS name assigned to be used in a Traffic Manager profile.

PublicIPAddress 资源属于 Azure 资源管理器资源。PublicIPAddress resources are Azure Resource Manager resources. 经典部署模型中没有这些资源。They do not exist in the classic deployment model. 因此,这些资源仅在流量管理器的 Azure 资源管理器体验中受支持。Thus they are only supported in Traffic Manager's Azure Resource Manager experiences. 其他终结点类型通过 Resource Manager 和经典部署模型受到支持。The other endpoint types are supported via both Resource Manager and the classic deployment model.

使用 Azure 终结点时,流量管理器可检测 Web 应用的停止和启动时间。When using Azure endpoints, Traffic Manager detects when a Web App is stopped and started. 此状态反映在终结点状态中。This status is reflected in the endpoint status. 有关详细信息,请参阅流量管理器终结点监视See Traffic Manager endpoint monitoring for details. 当基础服务停止时,流量管理器不会执行终结点运行状况检查,或者将流量定向到终结点。When the underlying service is stopped, Traffic Manager does not perform endpoint health checks or direct traffic to the endpoint. 已停止的实例不会发生流量管理器计费事件。No Traffic Manager billing events occur for the stopped instance. 重新启动服务后,计费会恢复,终结点可以接收流量。When the service is restarted, billing resumes and the endpoint is eligible to receive traffic. 此项检测不适用于 PublicIpAddress 终结点。This detection does not apply to PublicIpAddress endpoints.

外部终结点External endpoints

外部终结点用于 IPv4/IPv6 地址、FQDN,或用于 Azure 外部的服务。External endpoints are used for either IPv4/IPv6 addresses, FQDNs, or for services outside of Azure. 使用 IPv4/IPv6 地址终结点允许流量管理器检查终结点的运行状况,而无需为其指定 DNS 名称。Use of IPv4/IPv6 address endpoints allows traffic manager to check the health of endpoints without requiring a DNS name for them. 因此,在响应中返回终结点时,流量管理器可以使用 A/AAAA 记录响应查询。As a result, Traffic Manager can respond to queries with A/AAAA records when returning that endpoint in a response. Azure 外部的服务可以包括本地托管的服务或通过其他提供商托管的服务。Services outside of Azure can include a service hosted on-premises or with a different provider. 外部终结点可以单独使用,也可以与同一流量管理器配置文件中的 Azure 终结点结合使用,但指定为 IPv4 或 IPv6 地址的终结点除外,这些终结点只能是外部终结点。External endpoints can be used individually or combined with Azure Endpoints in the same Traffic Manager profile except for endpoints specified as IPv4 or IPv6 addresses which can only be external endpoints. 可以将 Azure 终结点与外部终结点结合用于多种方案:Combining Azure endpoints with External endpoints enables various scenarios:

  • 在主动-主动或主动-被动故障转移模型中,可以使用 Azure 为现有的本地应用程序提供增强的冗余。Provide increased redundancy for an existing on-premises application in either an active-active or active-passive failover model using Azure.
  • 将流量路由到没有与其关联的 DNS 名称的终结点。Route traffic to endpoints that do not have a DNS name associated with them. 此外,由于无需运行第二个 DNS 查询以返回 DNS 名称的 IP 地址,减少了整体 DNS 查找延迟。In addition, decrease the overall DNS lookup latency by removing the need to run a second DNS query to get an IP address of a DNS name returned.
  • 要为全球各地的用户降低应用程序延迟,可以将现有的本地应用程序扩展到 Azure 中的其他地理位置。Reduce application latency for users around the world, extend an existing on-premises application to additional geographic locations in Azure. 有关详细信息,请参阅流量管理器“性能”流量路由For more information, see Traffic Manager 'Performance' traffic routing.
  • 使用 Azure 为现有的本地应用程序提供额外容量,既可以持续满足高峰需求,也可以通过“云爆发”解决方案满足此类需求。Provide additional capacity for an existing on-premises application, either continuously or as a 'burst-to-cloud' solution to meet a spike in demand using Azure.

在某些情况下,可以使用外部终结点来引用 Azure 服务(有关示例,请参阅常见问题)。In certain cases, it is useful to use External endpoints to reference Azure services (for examples, see the FAQ). 在本示例中,针对运行状况检查的计费是按照 Azure 终结点费率而非外部终结点费率进行的。In this case, health checks are billed at the Azure endpoints rate, not the External endpoints rate. 但与 Azure 终结点不同,如果停止或删除基础服务,运行状况检查将持续计费,直到在流量管理器中禁用或删除该终结点为止。However, unlike Azure endpoints, if you stop or delete the underlying service, health check billing continues until you disable or delete the endpoint in Traffic Manager.

嵌套式终结点Nested endpoints

嵌套式终结点可以组合多个流量管理器配置文件,创建灵活的流量路由方案,帮助满足更大、更复杂的部署需求。Nested endpoints combine multiple Traffic Manager profiles to create flexible traffic-routing schemes and support the needs of larger, complex deployments. 使用嵌套式终结点时,会将“子”配置文件作为终结点添加到“父”配置文件。With Nested endpoints, a 'child' profile is added as an endpoint to a 'parent' profile. 子配置文件和父配置文件可包含任何类型的其他终结点,包括其他嵌套式配置文件。Both the child and parent profiles can contain other endpoints of any type, including other nested profiles. 有关详细信息,请参阅嵌套式流量管理器配置文件For more information, see nested Traffic Manager profiles.

Web 应用作为终结点Web Apps as endpoints

在流量管理器中将 Web 应用配置为终结点时,还需考虑其他因素:Some additional considerations apply when configuring Web Apps as endpoints in Traffic Manager:

  1. 仅“标准”SKU 或更高版 SKU 的 Web 应用可以用于流量管理器。Only Web Apps at the 'Standard' SKU or above are eligible for use with Traffic Manager. 尝试添加 SKU 较低的 Web 应用会失败。Attempts to add a Web App of a lower SKU fail. 降低现有 Web 应用的 SKU 会导致流量管理器不再将流量发送到该 Web 应用。Downgrading the SKU of an existing Web App results in Traffic Manager no longer sending traffic to that Web App. 有关支持的计划的详细信息,请参阅应用服务计划For more information on supported plans see the App Service Plans

  2. 当某个终结点收到 HTTP 请求时,将使用请求中的“host”标头来确定应通过哪个 Web 应用来处理请求。When an endpoint receives an HTTP request, it uses the 'host' header in the request to determine which Web App should service the request. 主机头包含用于启动请求的 DNS 名称,例如“contosoapp.chinacloudsites.cn”。The host header contains the DNS name used to initiate the request, for example 'contosoapp.chinacloudsites.cn'. 要对 Web 应用使用其他 DNS 名称,必须将该 DNS 名称注册为该应用的自定义域名。To use a different DNS name with your Web App, the DNS name must be registered as a custom domain name for the App. 将 Web 应用终结点添加为 Azure 终结点时,系统会自动为该应用注册流量管理器配置文件 DNS 名称。When adding a Web App endpoint as an Azure endpoint, the Traffic Manager profile DNS name is automatically registered for the App. 删除终结点时,会自动删除该注册。This registration is automatically removed when the endpoint is deleted.

  3. 每个流量管理器配置文件最多允许一个 Azure 区域有一个 Web 应用终结点。Each Traffic Manager profile can have at most one Web App endpoint from each Azure region. 若要克服这种约束,可为外部终结点配置一个 Web 应用。To work around for this constraint, you can configure a Web App as an External endpoint. 有关详细信息,请参阅常见问题For more information, see the FAQ.

启用和禁用终结点Enabling and disabling endpoints

在流量管理器中禁用终结点可能有助于从处于维护模式或正在重新部署的终结点中临时删除流量。Disabling an endpoint in Traffic Manager can be useful to temporarily remove traffic from an endpoint that is in maintenance mode or being redeployed. 在终结点再次运行后,可以重新启用该终结点。Once the endpoint is running again, it can be re-enabled.

可以通过流量管理器门户、PowerShell、CLI 或 REST API 启用和禁用终结点。Endpoints can be enabled and disabled via the Traffic Manager portal, PowerShell, CLI or REST API.

Note

禁用某个 Azure 终结点对其在 Azure 中的部署状态没有任何影响。Disabling an Azure endpoint has nothing to do with its deployment state in Azure. Azure 服务(例如 VM 或 Web 应用)将保持运行并可接收流量,即使已在流量管理器中禁用。An Azure service (such as a VM or Web App remains running and able to receive traffic even when disabled in Traffic Manager. 流量可直接定向到该服务实例,而无需通过流量管理器配置文件 DNS 名称。Traffic can be addressed directly to the service instance rather than via the Traffic Manager profile DNS name. 相关详细信息,请参阅流量管理器工作原理For more information, see how Traffic Manager works.

目前,每个终结点接收流量的资格取决于以下因素:The current eligibility of each endpoint to receive traffic depends on the following factors:

  • 配置文件状态(已启用/已禁用)The profile status (enabled/disabled)
  • 终结点状态(已启用/已禁用)The endpoint status (enabled/disabled)
  • 该终结点的运行状况检查结果The results of the health checks for that endpoint

相关详细信息,请参阅流量管理器终结点监视For details, see Traffic Manager endpoint monitoring.

Note

由于流量管理器是在 DNS 级别工作的,因此不可能影响任何终结点的现有连接。Since Traffic Manager works at the DNS level, it is unable to influence existing connections to any endpoint. 当某个终结点不可用时,流量管理器会将新连接定向到另一个可用的终结点。When an endpoint is unavailable, Traffic Manager directs new connections to another available endpoint. 不过,已禁用或不正常的终结点后面的主机仍可通过现有连接继续接收流量,直到相关会话被终止。However, the host behind the disabled or unhealthy endpoint may continue to receive traffic via existing connections until those sessions are terminated. 应用程序应该限制会话持续时间,以便耗尽现有连接的流量。Applications should limit the session duration to allow traffic to drain from existing connections.

如果禁用配置文件中的所有终结点,或者禁用配置文件本身,则流量管理器会向新的 DNS 查询发送“NXDOMAIN”响应。If all endpoints in a profile are disabled, or if the profile itself is disabled, then Traffic Manager sends an 'NXDOMAIN' response to a new DNS query.

常见问题解答FAQs

后续步骤Next steps