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

查看:23
本文介绍了如何为现有的本地群集配置和启用 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?

Service Fabric 反向代理的描述此处.它允许集群外部的客户端通过具有特殊 URL 的名称访问应用程序服务,而无需知道运行服务实例的确切主机:端口(可能会随着服务的自动移动而改变).

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 反向代理似乎没有为我的本地集群启用,其中包含两个无状态服务实例.我尝试使用 documented 端口 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.

也就是说,这是有效的:

To wit, this works:

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.

对于新集群,请在创建集群之前在集群配置 JSON 中进行设置,如@Scott Weldon 所述.

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:SfDevClusterDataFabricHostSettings.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:SfDevClusterDataFabricHostSettings.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 Explorer 中的 Manifest 选项卡),粘贴到一个新的 XML 文件中,增加版本号并进行如下修改:

在 NodeType Endpoints 部分,添加:

To the NodeType Endpoints section, add:

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

下,添加以下部分:

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 运行时群集代码包(可用 此处 - 请参阅发行说明 链接到 MSI) 到图像存储
  • 注册集群代码包
  • 启动并完成集群升级(我使用了不受监控的手动模式,一次只执行一个虚拟机,并且需要在每个节点完成后手动执行 Resume 命令)
  • 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天全站免登陆