azure - 负载平衡不适用于以下虚拟机配置

标签 azure azure-virtual-machine azure-load-balancer azure-availability-set

  1. 相同可用性集区域虚拟网络中创建了 2 个 Ubuntu 虚拟机安装了apache2。
  2. 将两个虚拟机的 index.html 重命名为: “这是VM1”,“这是VM2”。
  3. 使用以下配置创建了内部负载均衡器:
  • 前端 IP 配置:与可用区相同的 VNet、动态分配、区域冗余
  • 后端池:在 bepool 上选择了 2 个虚拟机
  • 运行状况探测:TCP 协议(protocol),端口 80
  • 负载均衡规则:TCP - 443 端口、选择创建的 bepool 和运行状况探测、TCP 重置 - 已启用、空闲超时 - 4 分钟
  • 入站 NAT 规则 - 与 LB 规则相同,但端口为 80。

问题是: 当我复制负载均衡器的前端 IP 并粘贴到浏览器中时,它没有显示任何输出,例如:

enter image description here

在虚拟机端,我在 NSG 中为两个虚拟机启用了端口 80、443 和 22。

如果出现该输出,那么我可以多次点击刷新页面来查看负载在两个虚拟机之间的分布情况,并显示来自 VM2 的“这是 VM1”。

最佳答案

我尝试在我的环境中重现相同的结果,并得到如下结果:

我创建了一个虚拟机:

  • VM 1 作为可用区域区域 1,入站端口为 HTTP(80) 且SSH (22)
  • VM 2 作为可用区域区域 2,入站端口为 HTTP(80) 且SSH (22)

然后我安装了 Apache Web 服务器,并为两个虚拟机重命名了 index.html,如下所示:

Vm1

enter image description here

虚拟机2

enter image description here

创建了一个负载均衡器类型,在前端IP中选择公共(public)创建了新的公共(public)IP:

enter image description here

在后端池中添加了两个虚拟机并添加运行状况探测。创建负载均衡器后,请验证两个虚拟机中分配的公共(public) IP 地址是否相同。

然后添加负载均衡器规则端口 80,如下所示:

enter image description here

现在,当我复制负载均衡器的前端 IP 并粘贴到浏览器中时,我成功得到了如下结果:

enter image description here

enter image description here

有时,如果我们刷新,我们无法重定向到另一台服务器,在服务器上保持事件状态,打开另一个选项卡刷新它,它将重定向多个虚拟机

更新

我创建了两个 ubuntu 虚拟机,其可用性设置在同一区域,并安装了 Apache vnet。

enter image description here

然后使用内部负载均衡器创建:

enter image description here

然后添加相同的前端 IP -> 后端池 -> 运行状况探测 -> 和 负载平衡规则 TCP 作为 80 端口

根据MSDocs

If your application hosted in the backend VM of an internal load balancer is trying to access another application hosted in the same backend VM over the same network interface, it's an unsupported scenario and will fail.

您需要使用 Windows 服务器创建另一个测试虚拟机,以访问具有相同虚拟网络的 RDP,或者在对等互连 vnet 时,您可以在对等互连基本 LB 有一些 limitations 时访问它。通过 Vnet 对等互连

我在这里创建了另一个虚拟机并连接到远程桌面,当我尝试访问负载均衡器的前端IP时,我成功得到了如下结果。

enter image description here enter image description here

关于azure - 负载平衡不适用于以下虚拟机配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74925033/

相关文章:

Azure Active Directory SCIM 映射

azure - 如何使 Azure 存储 (blob) 发挥作用?

Azure计算器API : How do I get expected network bandwidth metrics?

azure - 负载均衡器后面的 .NET Core VMS 上的 SSL

azure - Azure 如何跨应用服务实例拆分请求?

azure - 如何将现有路由表添加到子网

c# - BrokeredMessage 调用 OnMessage() 后自动释放

php - 使用任务计划程序运行 PHP 脚本时出现问题 (Windows Server 2008 R2)

Azure:禁用 .ppk 文件进行 ssh 连接

Azure - 无法为 ScaleSet 创建负载均衡器