在 Azure 中动态打开端口,负载均衡器是否足够智能,能够路由到正确的端口?

发布于 2024-10-22 22:06:57 字数 299 浏览 3 评论 0原文

据我所知,我只能在 Azure 应用程序中打开 5 个端点,但是如果我动态打开这些端口怎么办?示例:我有一个带有 WorkerRole ,然后实例号 1 在 5 个可用端点之一中打开一个套接字在“.csdef”文件中声明,当连接转到“myapp.cloudapp.net”时...连接是否有可能转到没有侦听套接字的第二个实例?

我想是的,由于负载均衡器使用循环调度,它并不关心,它可以将连接转发到第二个,但我可能是错的。

问候。

As far as I know I can only open 5 endpoints in an Azure application, but what if I open those ports dynamically? Example: I have a WorkerRole with an <Instances count="2" /> , then the instance number one open a socket in one of the 5 available endpoints I declared in the ".csdef" file, when a connection goes to "myapp.cloudapp.net" ... is there a chance that the connection goes to the second instance where there is not a listening socket?

I guess that yes, as the load balancer is using a round robin scheduling, it doesn't care and it could forward the connection to the second one, but I may be wrong.

Regards.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

国际总奸 2024-10-29 22:06:57

你猜对了。绝对没有办法将流量引导到特定实例,并且负载均衡器不知道您的实例是否正在运行侦听器。实现这一目标的唯一方法是让您的客户端应用程序(连接到 Windows Azure 部署的应用程序)不断重试,直到成功连接。

一般指导是 1) 让每个实例以相同的方式操作,在本例中为每个实例在端口上打开侦听器,2) 在添加到负载均衡器之前,在 OnStart() 方法中设置侦听器。

You guessed correctly. There's absolutely no way to direct traffic to a specific instance, and the load balancer has no idea if your instance has a listener running. The only way to make that work is for your client app (the one connecting to your Windows Azure deployment) to keep retrying until it gets a successful connection.

The general guidance is to 1) have each instance operate in the same manner, in this case opening listeners on the port for each instance and 2) setting up the listeners in the OnStart() method, prior to being added to the Load Balancer.

骷髅 2024-10-29 22:06:57

我猜你正在谈论一个InputEndpoint。但InternalEndpoints 不通过负载均衡器,可以由其他角色专门处理。因此,您可以在 Web 角色上设置一个处理程序,该处理程序可以将请求转发到您想要的特定辅助角色实例。

I guess that you are talking about an InputEndpoint. But InternalEndpoints do not go via the load balancer and can be addressed specifically by other roles. Therefore you could set up a handler on a web role that could forward the request to the specific worker role instance you want.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文