本地Azure Service Fabric Cluster的负载平衡器

时间:2021-02-06 03:54:40

As developers we wrote microservices on Azure Service Fabric and we can run them in Azure in some sort of PaaS concept for many customers. But some of our customers do not want to run in the cloud, as databases are on-premises and not going to be available from the outside, not even through a DMZ. It's ok, we promised to support it as Azure Service Fabric can be installed as a cluster on-premises.

作为开发人员,我们在Azure Service Fabric上编写了微服务,我们可以在Azure中以某种PaaS概念为许多客户运行它们。但是我们的一些客户不希望在云中运行,因为数据库是本地的,而不是从外部可用,甚至不是通过DMZ。没关系,我们承诺支持它,因为Azure Service Fabric可以作为集群安装在本地。

We have an API-gateway microservice running inside the cluster on every virtual machine, which uses the name resolver, and requests are routed and distributed accordingly, but the API that the API gateway microservice provides is the entrance for another piece of client software which our customers use, that software runs outside of the cluster and have to send requests to the API.

我们在每个虚拟机上的集群内运行API网关微服务,它使用名称解析器,并相应地路由和分发请求,但API网关微服务提供的API是我们的另一个客户端软件的入口。客户使用,该软件在集群外部运行,并且必须向API发送请求。

I suggested to use an Load Balancer like HA-Proxy or Nginx on a seperate machine (or machines) where the client software send their requests to and then the reverse proxy would forward it to an available machine inside the cluster.

我建议在客户端软件发送请求的单独机器(或机器)上使用HA-Proxy或Nginx等负载均衡器,然后反向代理将其转发到集群内的可用机器。

It seems that is not what our customer want, another machine as load balancer is not an option. They suggest: make the client software smarter to figure out which host to go to, in other words: we should write our own fail-over/load balancer inside the client software.

这似乎不是我们客户想要的,另一台机器作为负载均衡器不是一种选择。他们建议:让客户端软件变得更聪明,找出要去哪个主机,换句话说:我们应该在客户端软件中编写自己的故障转移/负载均衡器。

What other options do we have?

我们还有其他选择吗?

  • Install Network Load Balancer Feature on each of the virtual machine to give the cluster a single IP address, is this even possible? Something like https://www.poweradmin.com/blog/configuring-network-load-balancing-in-windows-server/

    在每个虚拟机上安装网络负载均衡器功能,为集群提供单个IP地址,这是否可能?像https://www.poweradmin.com/blog/configuring-network-load-balancing-in-windows-server/

  • Suggest an API gateway outside the cluster, like KONG https://getkong.org/

    建议群集外的API网关,如KONG https://getkong.org/

  • Something else ?

    别的什么?

PS: The client applications do not send many requests per second, maybe a few per minute.

PS:客户端应用程序每秒发送的请求不多,可能每分钟发送一次。

3 个解决方案

#1


3  

Very similar problem, we have a many services and Service Fabric Cluster that runs on-premises. When it's time to use the load balancer we install IIS on the same machine where Service Fabric cluster runs. As the IIS is a good load balancer we use IIS as a reverse proxy only for API Gateway. Kestrel hosting is using for other services that communicate by HTTP. The API gateway microservice is the single entry point for all clients and has always static URI inside SF, we used that URI to configure IIS

非常类似的问题,我们有许多服务和服务结构集群在本地运行。在使用负载均衡器的时候,我们在运行Service Fabric集群的同一台机器上安装IIS。由于IIS是一个很好的负载均衡器,我们使用IIS作为API网关的反向代理。 Kestrel托管用于通过HTTP进行通信的其他服务。 API网关微服务是所有客户端的单一入口点,并且在SF内部始终具有静态URI,我们使用该URI来配置IIS

If you do not have possibility to use IIS then look at Using nginx as HTTP load balancer

如果您没有可能使用IIS,请查看使用nginx作为HTTP负载均衡器

#2


1  

You don't need another machine just for HTTP forwarding. Just use/run it as a service on the cluster.

您不需要另一台机器只用于HTTP转发。只需将其作为群集上的服务使用/运行即可。

Did you consider using the built in Reverse Proxy of Service Fabric? This runs on all nodes, and it will forward http calls to services inside the cluster.

您是否考虑使用内置的Service Fabric反向代理?它在所有节点上运行,它将http调用转发到集群内的服务。

You can also run nginx as a guest executable or inside a Container on the cluster.

您还可以将nginx作为来宾可执行文件运行,或者在集群中的Container中运行。

#3


0  

We have also faced the same situation when started working with service fabric cluster. We configured Application Gateway as Proxy but it would not provide the function like HTTP to HTTPS redirection.

在开始使用服务结构集群时,我们也遇到了同样的情况。我们将Application Gateway配置为Proxy,但它不提供HTTP到HTTPS重定向等功能。

For that, we configured Nginx Instead of Azure Application Gateway as Proxy to Service Fabric Application.

为此,我们将Nginx而不是Azure Application Gateway配置为Service Fabric应用程序的代理。

#1


3  

Very similar problem, we have a many services and Service Fabric Cluster that runs on-premises. When it's time to use the load balancer we install IIS on the same machine where Service Fabric cluster runs. As the IIS is a good load balancer we use IIS as a reverse proxy only for API Gateway. Kestrel hosting is using for other services that communicate by HTTP. The API gateway microservice is the single entry point for all clients and has always static URI inside SF, we used that URI to configure IIS

非常类似的问题,我们有许多服务和服务结构集群在本地运行。在使用负载均衡器的时候,我们在运行Service Fabric集群的同一台机器上安装IIS。由于IIS是一个很好的负载均衡器,我们使用IIS作为API网关的反向代理。 Kestrel托管用于通过HTTP进行通信的其他服务。 API网关微服务是所有客户端的单一入口点,并且在SF内部始终具有静态URI,我们使用该URI来配置IIS

If you do not have possibility to use IIS then look at Using nginx as HTTP load balancer

如果您没有可能使用IIS,请查看使用nginx作为HTTP负载均衡器

#2


1  

You don't need another machine just for HTTP forwarding. Just use/run it as a service on the cluster.

您不需要另一台机器只用于HTTP转发。只需将其作为群集上的服务使用/运行即可。

Did you consider using the built in Reverse Proxy of Service Fabric? This runs on all nodes, and it will forward http calls to services inside the cluster.

您是否考虑使用内置的Service Fabric反向代理?它在所有节点上运行,它将http调用转发到集群内的服务。

You can also run nginx as a guest executable or inside a Container on the cluster.

您还可以将nginx作为来宾可执行文件运行,或者在集群中的Container中运行。

#3


0  

We have also faced the same situation when started working with service fabric cluster. We configured Application Gateway as Proxy but it would not provide the function like HTTP to HTTPS redirection.

在开始使用服务结构集群时,我们也遇到了同样的情况。我们将Application Gateway配置为Proxy,但它不提供HTTP到HTTPS重定向等功能。

For that, we configured Nginx Instead of Azure Application Gateway as Proxy to Service Fabric Application.

为此,我们将Nginx而不是Azure Application Gateway配置为Service Fabric应用程序的代理。