Google计算引擎负载平衡无法正确路由 [英] Google compute engine load balancing not routing properly

查看:69
本文介绍了Google计算引擎负载平衡无法正确路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Google计算引擎的新手,我尝试设置网络负载平衡,该网络负载平衡具有2个用于服务网页的VM.

I am new to Google compute engine and I am try to setup network load balancing having 2 VMs for serving web pages.

例如,我有2个虚拟机-app1和app2-都具有apache服务器并提供简单的网页.

For ex, I have 2 VMs - app1 and app2 - both having apache server and serves simple web page.

两个VM都与Red Hat Enterprise Linux Server 7.0(Maipo)一起运行

Both VMs are running with Red Hat Enterprise Linux Server release 7.0 (Maipo)

我能够通过浏览器中的IP访问两个网页.

I am able to access both web pages through the IP in browser.

我创建了网络负载平衡设置,并且两个应用程序在目标池中均显示为绿色,这意味着负载平衡器能够连接到两个VM.

I created network load balancing setup and both apps are showing in green in target pool which means load balancer is able to connect to both VMs.

但是,当我点击负载均衡器的IP时,它仅从一台服务器渲染页面.如果我在VM中手动停止服务器,则负载均衡器IP重定向到其他应用程序.我相信负载平衡器能够识别两个VM的运行状况并能够重定向.

But, when I hit the IP of load balancer, it is rendering page from only one server. If I manually stop the server in the VM, load balancer IP redirects to other app. I believe load balancer is able to identify health of both VMs and able to redirect.

但是它不能平衡流量.谁能帮我解决这个问题?

But it is not balancing the traffic. Can anyone help me to solve this issue?

推荐答案

我认为网络负载平衡器不会以循环方式转发流量.我能够使用我拥有的负载均衡器设置对其进行测试.根据文档:

I think that the network load balancer doesn't forward the traffic on a round-robin basis. I was able to test it with the load balancer setup that I have. As per the documentation:

默认情况下,为了将流量分配给实例,Google Compute Engine根据源IP和端口以及目标IP和端口的哈希值选择一个实例.

By default, to distribute traffic to instances, Google Compute Engine picks an instance based on a hash of the source IP and port and the destination IP and port.

这篇关于Google计算引擎负载平衡无法正确路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆