验证流量管理器设置Verify Traffic Manager settings

若要测试流量管理器设置,需要在不同的位置准备多个客户端,以便从中运行测试。To test your Traffic Manager settings, you need to have multiple clients, in various locations, from which you can run your tests. 然后,逐个关闭流量管理器配置文件中的终结点。Then, bring the endpoints in your Traffic Manager profile down one at a time.

  • 为 DNS TTL 设置一个较小的值(例如 30 秒),以便快速传播更改。Set the DNS TTL value low so that changes propagate quickly (for example, 30 seconds).
  • 了解要测试的配置文件中的 Azure 云服务和网站的 IP 地址。Know the IP addresses of your Azure cloud services and websites in the profile you are testing.
  • 使用工具将 DNS 名称解析为 IP 地址并显示该地址。Use tools that let you resolve a DNS name to an IP address and display that address.

检查 DNS 名称是否可解析为配置文件中的终结点的 IP 地址。You are checking to see that the DNS names resolve to IP addresses of the endpoints in your profile. 名称的解析方式应与流量管理器配置文件中定义的流量路由方法一致。The names should resolve in a manner consistent with the traffic routing method defined in the Traffic Manager profile. 可以使用 nslookupdig 等工具来解析 DNS 名称。You can use the tools like nslookup or dig to resolve DNS names.

以下示例可帮助测试流量管理器配置文件。The following examples help you test your Traffic Manager profile.

在 Windows 中使用 nslookup 和 ipconfig 检查流量管理器配置文件Check Traffic Manager profile using nslookup and ipconfig in Windows

  1. 以管理员身份打开命令提示符或 Windows PowerShell 提示符。Open a command or Windows PowerShell prompt as an administrator.

  2. 键入 ipconfig /flushdns 以刷新 DNS 解析程序缓存。Type ipconfig /flushdns to flush the DNS resolver cache.

  3. 键入 nslookup <your Traffic Manager domain name>Type nslookup <your Traffic Manager domain name>. 例如,以下命令会检查前缀为 myapp.contoso 的域名For example, the following command checks the domain name with the prefix myapp.contoso

     nslookup myapp.contoso.trafficmanager.cn
    

    典型的结果会显示以下信息:A typical result shows the following information:

    • 为解析此流量管理器域名而访问的 DNS 服务器的 DNS 名称和 IP 地址。The DNS name and IP address of the DNS server being accessed to resolve this Traffic Manager domain name.
    • 在命令行中“nslookup”后键入的流量管理器域名以及该流量管理器域解析为的 IP 地址。The Traffic Manager domain name you typed on the command line after "nslookup" and the IP address to which the Traffic Manager domain resolves. 需要重点检查第二个 IP 地址。The second IP address is the important one to check. 它应当与所测试的流量管理器配置文件中某个云服务或网站的公用虚拟 IP (VIP) 地址匹配。It should match a public virtual IP (VIP) address for one of the cloud services or websites in the Traffic Manager profile you are testing.

如何测试故障转移流量路由方法How to test the failover traffic routing method

  1. 使所有终结点保持运行状态。Leave all endpoints up.
  2. 在单个客户端中,使用 nslookup 或类似的实用工具请求对公司域名进行 DNS 解析。Using a single client, request DNS resolution for your company domain name using nslookup or a similar utility.
  3. 确保解析的 IP 地址与主终结点匹配。Ensure that the resolved IP address matches the primary endpoint.
  4. 关闭主终结点或删除监视文件,使流量管理器认为应用程序已关闭。Bring down your primary endpoint or remove the monitoring file so that Traffic Manager thinks that the application is down.
  5. 等待流量管理器配置文件的 DNS 生存时间 (TTL),再额外等待两分钟。Wait for the DNS Time-to-Live (TTL) of the Traffic Manager profile plus an additional two minutes. 例如,如果 DNS TTL 为 300 秒(5 分钟),则必须等待 7 分钟。For example, if your DNS TTL is 300 seconds (5 minutes), you must wait for seven minutes.
  6. 刷新 DNS 客户端缓存,并使用 nslookup 请求 DNS 解析。Flush your DNS client cache and request DNS resolution using nslookup. 在 Windows 中,可以使用 ipconfig /flushdns 命令刷新 DNS 缓存。In Windows, you can flush your DNS cache with the ipconfig /flushdns command.
  7. 确保解析的 IP 地址与辅助终结点匹配。Ensure that the resolved IP address matches your secondary endpoint.
  8. 重复该过程,依次关闭每个终结点。Repeat the process, bringing down each endpoint in turn. 检查 DNS 是否返回列表中下一个终结点的 IP 地址。Verify that the DNS returns the IP address of the next endpoint in the list. 关闭所有终结点后,应该再次得到主终结点的 IP 地址。When all endpoints are down, you should obtain the IP address of the primary endpoint again.

如何测试加权流量路由方法How to test the weighted traffic routing method

  1. 使所有终结点保持运行状态。Leave all endpoints up.
  2. 在单个客户端中,使用 nslookup 或类似的实用工具请求对公司域名进行 DNS 解析。Using a single client, request DNS resolution for your company domain name using nslookup or a similar utility.
  3. 确保解析的 IP 地址与某个终结点匹配。Ensure that the resolved IP address matches one of your endpoints.
  4. 刷新 DNS 客户端缓存,针对每个终结点重复步骤 2 和 3。Flush your DNS client cache and repeat steps 2 and 3 for each endpoint. 应该会看到,为每个终结点返回的 IP 地址都不相同。You should see different IP addresses returned for each of your endpoints.

如何测试性能流量路由方法How to test the performance traffic routing method

要有效地测试性能流量路由方法,必须在世界各地拥有客户端。To effectively test a performance traffic routing method, you must have clients located in different parts of the world. 可以在不同的 Azure 区域中创建用于测试服务的客户端。You can create clients in different Azure regions that can be used to test your services. 如果有全球网络,可以远程登录到位于世界另一地点的客户端,从中运行测试。If you have a global network, you can remotely sign in to clients in other parts of the world and run your tests from there.

或者,可以使用基于 Web 的免费 DNS 查找和挖掘服务。Alternatively, there are free web-based DNS lookup and dig services available. 使用其中的某些工具可以从全球的不同位置检查 DNS 名称解析。Some of these tools give you the ability to check DNS name resolution from various locations around the world. 例如,针对“DNS 查找”执行搜索。Do a search on "DNS lookup" for examples. 可以使用 Gomez 或 Keynote 等第三方服务来确认配置文件是否按预期分布流量。Third-party services like Gomez or Keynote can be used to confirm that your profiles are distributing traffic as expected.

后续步骤Next steps