如何为现有的本地群集配置和启用Azure Service Fabric反向代理? [英] How to configure and enable Azure Service Fabric Reverse Proxy for an existing on-premises cluster?

查看:82
本文介绍了如何为现有的本地群集配置和启用Azure Service Fabric反向代理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

内部部署群集中是否可以使用Azure Service Fabric反向代理?如果是这样,如何为现有集群启用它?

Is the Azure Service Fabric Reverse Proxy available in an on-premises cluster? If so, how can I enable it for an existing cluster?

此处描述了服务结构反向代理>.它允许群集外部的客户端按名称使用特殊URL访问应用程序服务,而无需知道运行服务实例的确切host:port(随着服务自动移动,该端口可能会更改).

The Service Fabric Reverse Proxy is described here. It allows clients external to the cluster to access application services by name with a special URL, without needing to know the exact host:port on which an instance of the service is running (which may change as services are automatically moved around).

默认情况下,带有两个无状态服务实例的本地群集似乎未启用Service Fabric反向代理.我尝试使用已记录端口19008,但无法使用推荐的URI语法访问服务.

By default the Service Fabric Reverse Proxy does not appear to be enabled for my on-prem cluster with two instances of a stateless service. I tried using the documented port 19008 but could not reach the service using the recommended URI syntax.

这很有效:

http://fqdn:20001/api/odata/v1/$metadata

但这不是:

http://fqdn:19008/MyApp/MyService/api/odata/v1/$metadata

在用于设置本地群集的ClusterConfig JSON的NodeTypes部分中,有一个属性"httpGatewayEndpointPort":"19080",但是该端口似乎不能用作反向代理(它是服务Fabric Explorer Web应用程序端点).我猜想在集群配置JSON中以某种方式指定了所需的配置. 参考文章中有说明,说明了如何在云中配置反向代理,但不在本地中配置.

In the NodeTypes section of the ClusterConfig JSON used to set up my on-prem cluster, there is a property "httpGatewayEndpointPort": "19080", but that port does not appear to work as a reverse proxy (it is the Service Fabric Explorer web-app endpoint). I am guessing that the needed configuration is specified somehow in the cluster config JSON. There are instructions in the referenced article that explain how to configure the reverse proxy in the cloud, but not on-premises.

我要寻找的是有关如何在本地多计算机群集或开发群集中设置Service Fabric反向代理的说明.

What I am looking for are instructions on how to set up the Service Fabric reverse proxy in an on-premises multi-machine cluster or dev cluster.

推荐答案

是的,反向代理可以在本地使用.

Yes, the reverse proxy is available on-premises.

要使其适用于现有集群,必须在集群配置XML中对其进行配置和启用,然后必须部署新配置,如下所述.

To get it working for an existing cluster, it must be configured and enabled in the cluster config XML and then the new config must be deployed, as described below.

对于新集群,请按照@Scott Weldon的说明在创建集群之前在集群配置JSON中进行设置.

For a new cluster, set it up in the cluster config JSON before creating the cluster, as described by @Scott Weldon.

@Senj提供了线索(谢谢!),这使我找到了答案.我最近将我的开发箱上的Service Fabric位更新为5.1.163.9590.当我查看C:\ SfDevCluster \ Data \ FabricHostSettings.xml时,发现以下内容:

@Senj provided the clue (thanks!) that led me to the answer. I had recently updated my Service Fabric bits on my dev box to 5.1.163.9590. When I looked in C:\SfDevCluster\Data\FabricHostSettings.xml, I noticed the following:

 <Section Name="FabricNode">
    ...
    <Parameter Name="NodeVersion" Value="5.1.163.9590:1.0:0" />
    ...
    <Parameter Name="HttpApplicationGatewayListenAddress" Value="19081" />
    <Parameter Name="HttpApplicationGatewayProtocol" Value="http" />
    ...
  </Section>

有趣!开发集群启动后,我浏览到:

Interesting! With the dev cluster fired up, I browsed to:

http://localhost:19081/MyApp/MyService/api/odata/v1/$metadata

瞧!我的API返回了预期的数据.因此,@ Senj是正确的,它与HttpApplicationGateway设置有关.我猜想在最新的SDK版本中,它是预先配置并默认启用的. (让我震惊的是,所有文档都引用了端口19008,但实际配置的端口是19081!)

and voila! My API returned the expected data. So @Senj was correct that it has to do with the HttpApplicationGateway settings. I am guessing that in the latest SDK version it is pre-configured and enabled by default. (What threw me off is all the docs refer to port 19008, but the actual configured port was 19081!)

为了使反向代理能够在真实的"多计算机(VM)集群上工作,我做了以下工作(注意:我认为没有必要升级集群代码包,但是由于我没有任何帮助)我的映像存储用于集群升级,并且集群升级过程需要一个代码包,我使用的是最新版本):

In order to get the reverse proxy to work on the 'real' multi-machine (VM) cluster, I did the following (Note: I don't think upgrading the cluster codepackage was necessary, but since I had nothing in my image store for the cluster upgrade, and the cluster upgrade process requires a code package, I used the latest version):

  1. 复制现有的群集清单(从Service Fabric资源管理器的清单"选项卡中),粘贴到新的XML文件中,修改版本号并进行如下修改:

在"NodeType端点"部分中,添加:

To the NodeType Endpoints section, add:

<NodeTypes>
    <NodeType Name="NodeType0">
      <Endpoints>
        <HttpApplicationGatewayEndpoint Port="19081" Protocol="http" />
        ...
      </Endpoints>
    </NodeType>
</NodeTypes>

,然后在<FabricSettings>下添加以下部分:

and under <FabricSettings>, add the following section:

<Section Name="ApplicationGateway/Http">
  <Parameter Name="IsEnabled" Value="true" />
</Section>

  1. 使用Service Fabric PowerShell命令:

  1. Using Service Fabric PowerShell commands:

  • 将新的群集配置(先前复制的manifest.xml)复制到结构映像存储中
  • 注册新的群集配置
  • 复制Service Fabric运行时群集代码包(可用
  • Copy the new cluster config (the previously copied manifest.xml) to the fabric image store
  • Register the new cluster config
  • Copy the Service Fabric Runtime cluster codepackage (available here - see the release notes for the link to the MSI) to the image store
  • Register the cluster codepackage
  • Start and complete cluster upgrade (I used unmonitored manual mode, which does one VM at a time and requires a manual Resume command after each node is complete)

集群升级完成后,我能够使用反向代理端点和appname/servicename URL语法查询我的服务API:

After the cluster upgrade was complete, I was able to query my service API using the reverse proxy endpoint and appname/servicename URL syntax:

http://fqdn:19081/MyApp/MyService/api/odata/v1/$metadata

这篇关于如何为现有的本地群集配置和启用Azure Service Fabric反向代理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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