Google云负载平衡器端口80,连接到服务端口9000的VM实例 [英] Google cloud load balancer port 80, to VM instances serving port 9000

查看:115
本文介绍了Google云负载平衡器端口80,连接到服务端口9000的VM实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是GCE的新手,我对设置负载平衡器感到困惑.

I'm new in GCE, and I am confused about setting up the load balancer.

如果我有两个实例,在端口9000上服务,我想设置一个在端口80上接受的平衡器,然后将请求路由到我在端口9000上的实例.

If I have two instances, serving on Port 9000, I want to setup a balancer that accepts on port 80, then route requests to my instances in port 9000..

像这样的图.

LB:port:80 -> VM:port:9000

我还有其他提供商提供的其他负载均衡器,其设置类似于指向VM的端口.但是在GCE中,我似乎找不到它,或者我丢失了一些东西.

I have other load balancers from other providers which has a settings like pointing to VM's port. but in GCE, I cant seem to find it, or I am missing something..

我希望我在这里有道理.预先谢谢你

I hope I am making a sense, here. thank you in advance

推荐答案

在GCE中无法进行端口重写.解决方法是,我使用使用iptables进行端口转发 然后在GCE中,您可以在端口9000上创建运行状况检查,目标池将在实例9000上列出您的实例,而您的转发规则将在目标池的端口80上.

It isn't possible in GCE to do a port rewriting. As a workaround I use port forwarding using iptables Then in GCE, you can create a health check on port 9000, your target pool will have your instances listing on port 9000 and your forwarding rule will be on port 80 with your target pool.

另一种解决方法是在实例上运行HAProxy,以将实例上的端口80本地转发到端口9000.

Another workaround will be to run HAProxy on the instance to locally forward port 80 on the instance to port 9000.

这篇关于Google云负载平衡器端口80,连接到服务端口9000的VM实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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