简体   繁体   English

使用资源管理器在虚拟机规模集上设置Azure多个公共IP

[英]Azure Multiple Public IPs on a Virtual Machine Scale Set with Resource Manager

We try to migrate our Platform from classical IIS hosting to a service fabric micro service architecture. 我们尝试将平台从传统的IIS托管迁移到服务结构微服务架构。 So fare we learned that a service fabric lives in a virtual machine scale set and uses Load balancer to communicate to the outside world. 因此,我们了解到服务结构存在于虚拟机规模集中,并使用负载均衡器与外部世界进行通信。

The Problem we now facing is that we have different access points to our application. 我们现在面临的问题是我们的应用程序具有不同的访问点。 Like one for browser, one for mobile app. 就像一个用于浏览器,一个用于移动应用。 Both use the standard https port, but are different applications. 两者都使用标准的https端口,但它们是不同的应用程序。

In iis we could use host headers to direct traffic to one or the other application. 在iis中,我们可以使用主机头将流量定向到一个或另一个应用程序。 But with service fabric we can't. 但是服务面料我们做不到。 easiest way for us would be multiple public IP's. 对我们来说最简单的方法就是多个公共IP。 With that we could handle it with dns. 有了它,我们可以用dns处理它。 We considered a couple solutions with no success. 我们考虑了一些没有成功的解决方案。

  1. Load balancer with Multiple public ip's. 带有多个公共IP的负载均衡器。 Problem: it looks like that only works with Cloud Services and we need to work with the new Resource Manager World there it seems to be not possible to have multiple public ip's. 问题:它看起来只适用于云服务,我们需要使用新的资源管理器世界,似乎不可能有多个公共IP。

  2. Multiple public load balancer. 多个公共负载均衡器。 Problem: Scale Sets accept only on load balancer instance pert load balancer type. 问题:比例集仅接受负载均衡器实例的负载均衡器类型。

  3. Application Gateway. 应用网关。 Seems not to support multiple public ip's or host header mapping. 似乎不支持多个公共IP或主机头映射。

  4. Path mapping. 路径映射。 Problem: we have the same path in different applications. 问题:我们在不同的应用程序中具有相同的路径。

My questions are: 我的问题是:

Is there any solution to use multiple IP's and map the traffic internally to different ports? 有没有任何解决方案可以使用多个IP并将流量内部映射到不同的端口?

Is there any option to use host header mapping with service fabric? 有没有选择使用主机头映射与服务结构?

Any suggestion how I can solve my problem? 有什么建议我怎么解决我的问题?

Piling on some Service Fabric-specific info to Eli's answer: Yes you can do all of this and use an http.sys-based self-hosted web server to host multiple sites using different host names on a single VIP, such as Katana or WebListener in ASP.NET Core 1. 将一些特定于Service Fabric的信息堆积到Eli的答案:是的,您可以执行所有这些并使用基于http.sys的自托管Web服务器在单个VIP上使用不同的主机名托管多个站点,例如Katana或WebListener在ASP.NET Core 1中。

The piece to this that is currently missing in Service Fabric is a way to configure the hostname in your endpoint definition in ServiceManifest.xml. Service Fabric中当前缺少的部分是一种在ServiceManifest.xml中配置端点定义中的主机名的方法。 Service Fabric services run under Network Service by default on Windows, which means the service will not have access to create a URL ACL for the URL it wants to open an endpoint on. 默认情况下,Windows上的Service Fabric服务在网络服务下运行,这意味着该服务无权为其打开端点的URL创建URL ACL。 To help with that, when you specify an HTTP endpoint in an endpoint definition in ServiceManifest.xml, Service Fabric automatically creates the URL ACL for you. 为此,当您在ServiceManifest.xml中的端点定义中指定HTTP端点时,Service Fabric会自动为您创建URL ACL。 But currently, there is no place to specify a hostname, so Service Fabric uses "+", which is the strong wildcard that matches everything. 但是目前,没有地方可以指定主机名,因此Service Fabric使用“+”,这是匹配所有内容的强通配符。

For now, this is merely an inconvenience because you'll have to create a setup entry point with your service that runs under elevated privileges to run netsh to setup the URL ACL manually. 目前,这只是一个不便之处,因为您必须使用在提升权限下运行的服务创建一个设置入口点 ,以便运行netsh以手动设置URL ACL。

We do plan on adding a hostname field in ServiceManifest.xml to make this easier. 我们计划在ServiceManifest.xml中添加主机名字段以使其更容易。

It's definitely possible to use ARM templates to deploy a Service Fabric cluster with multiple IPs. 绝对可以使用ARM模板部署具有多个IP的Service Fabric群集。 You'll just have to tweak the template a bit: 你只需稍微调整一下模板:

  • Create multiple IP address resources (eg using copy ) - make sure you review all the resources using the IP and modify them appropriately 创建多个IP地址资源(例如,使用copy ) - 确保使用IP查看所有资源并进行适当修改
  • In the load balancer: 在负载均衡器中:
    • Add multiple frontendIPConfigurations , each tied to its own IP 添加多个frontendIPConfigurations ,每个都绑定到自己的IP
    • Add loadBalancingRules for each port you want to redirect to the VMs from a specific frontend IP configuration 为要从特定前端IP配置重定向到VM的每个端口添加loadBalancingRules
    • Add probes 添加探针

As for host header mapping, this is handled by the Windows HTTP Server API (see this article ). 对于主机头映射,这由Windows HTTP Server API处理(请参阅此文章 )。 All you have to do is use a specific host name (or even a URL path) when configuring an HTTP listener URL (in OWIN/ASP.NET Core). 在配置HTTP侦听器URL(在OWIN / ASP.NET Core中)时,您所要做的就是使用特定的主机名(甚至是URL路径)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM