简体   繁体   English

如何为现有的内部部署群集配置和启用Azure Service Fabric反向代理?

[英]How to configure and enable Azure Service Fabric Reverse Proxy for an existing on-premises cluster?

Is the Azure Service Fabric Reverse Proxy available in an on-premises cluster? Azure服务结构反向代理是否可在内部部署群集中使用? If so, how can I enable it for an existing cluster? 如果是这样,我如何为现有群集启用它?

The Service Fabric Reverse Proxy is described here . 此处描述 Service Fabric Reverse Proxy。 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). 它允许群集外部的客户端通过名称使用特殊URL访问应用程序服务,而无需知道运行服务实例的确切主机:端口(可能会随着服务自动移动而更改)。

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. 默认情况下,似乎没有为具有两个无状态服务实例的本地群集启用Service Fabric反向代理。 I tried using the documented port 19008 but could not reach the service using the recommended URI syntax. 我尝试使用记录的端口19008,但无法使用推荐的URI语法访问该服务。

To wit, this works: 即,这工作:

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

but this does not: 但这不是:

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

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). 在用于设置我的本地群集的ClusterConfig JSON的NodeTypes部分中,有一个属性“httpGatewayEndpointPort”:“19080”,但该端口似乎不能用作反向代理(它是Service Fabric Explorer Web -app endpoint)。 I am guessing that the needed configuration is specified somehow in the cluster config JSON. 我猜测在集群配置JSON中以某种方式指定了所需的配置。 There are instructions in the referenced article that explain how to configure the reverse proxy in the cloud, but not on-premises. 参考文章中有说明解释了如何在云中配置反向代理,但不在本地配置。

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. 我正在寻找的是有关如何在本地多机群集或开发群集中设置Service Fabric反向代理的说明。

Yes, the reverse proxy is available on-premises. 是的,反向代理可在本地使用。

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. 要使其适用于现有群集,必须在群集配置XML中对其进行配置和启用,然后必须部署新配置,如下所述。

For a new cluster, set it up in the cluster config JSON before creating the cluster, as described by @Scott Weldon. 对于新群集,请在创建群集之前在群集配置JSON中进行设置,如@Scott Weldon所述。

@Senj provided the clue (thanks!) that led me to the answer. @Senj提供了线索(谢谢!),这让我得到答案。 I had recently updated my Service Fabric bits on my dev box to 5.1.163.9590. 我最近在我的开发盒上更新了我的Service Fabric位到5.1.163.9590。 When I looked in C:\\SfDevCluster\\Data\\FabricHostSettings.xml, I noticed the following: 当我查看C:\\ SfDevCluster \\ Data \\ FabricHostSettings.xml时,我注意到以下内容:

 <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

and voila! 瞧! My API returned the expected data. 我的API返回了预期的数据。 So @Senj was correct that it has to do with the HttpApplicationGateway settings. 所以@Senj是正确的,它与HttpApplicationGateway设置有关。 I am guessing that in the latest SDK version it is pre-configured and enabled by default. 我猜测在最新的SDK版本中,它是预先配置并默认启用的。 (What threw me off is all the docs refer to port 19008, but the actual configured port was 19081!) (让我失望的是所有文档都引用了端口19008,但实际配置的端口是19081!)

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): 为了让反向代理在“真正的”多机(VM)集群上工作,我做了以下(注意:我不认为升级集群代码包是必要的,但因为我的图像存储中没有任何内容对于集群升级,集群升级过程需要代码包,我使用的是最新版本):

  1. Copy the existing cluster manifest (from the Manifest tab in Service Fabric Explorer), paste into a new XML file, bump the version number and modify as follows: 复制现有群集清单(从Service Fabric Explorer中的Manifest选项卡),粘贴到新的XML文件中,修改版本号并修改如下:

To the NodeType Endpoints section, add: 在NodeType端点部分,添加:

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

and under <FabricSettings> , add the following section: <FabricSettings> ,添加以下部分:

<Section Name="ApplicationGateway/Http">
  <Parameter Name="IsEnabled" Value="true" />
</Section>
  1. Using Service Fabric PowerShell commands: 使用Service Fabric PowerShell命令:

    • Copy the new cluster config (the previously copied manifest.xml) to the fabric image store 将新的群集配置(以前复制的manifest.xml)复制到结构映像存储
    • 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 将Service Fabric Runtime集群代码包( 此处提供 - 请参阅MSI链接的发行说明)复制到映像存储
    • 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) 启动并完成集群升级(我使用了不受监控的手动模式,它一次只能运行一个VM,并且在每个节点完成后需要手动恢复命令)

After the cluster upgrade was complete, I was able to query my service API using the reverse proxy endpoint and appname/servicename URL syntax: 集群升级完成后,我可以使用反向代理端点和appname / servicename URL语法查询我的服务API:

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

I enabled this in the standalone installer version (5.1.156) by adding the following line to the JSON configuration file under the nodeTypes element (I used ClusterConfig.Unsecure.MultiMachine.json but I assume any of the JSON files would work): 我在独立安装程序版本(5.1.156)中通过将以下行添加到nodeTypes元素下的JSON配置文件中来启用此功能(我使用了ClusterConfig.Unsecure.MultiMachine.json但我假设任何JSON文件都可以工作):

"httpApplicationGatewayEndpointPort": "19081"

So the final nodeTypes looked like this: 所以最终的nodeTypes看起来像这样:

"nodeTypes": [
    {
        "name": "NodeType0",
        "clientConnectionEndpointPort": "19000",
        "clusterConnectionEndpoint": "19001",
        "httpGatewayEndpointPort": "19080",
        "httpApplicationGatewayEndpointPort": "19081",
        "applicationPorts": {
            "startPort": "20001",
            "endPort": "20031"
        },
        "ephemeralPorts": {
            "startPort": "20032",
            "endPort": "20062"
        },
        "isPrimary": true
    }
]

I think it has something to do with the HttpApplicationGatewayEndpoint property, see also my question on https://github.com/Azure/service-fabric-issues/issues/5 But it doesn't work for me.. 我认为它与HttpApplicationGatewayEndpoint属性有关,另请参阅https://github.com/Azure/service-fabric-issues/issues/5上的问题但是它对我不起作用..

Also notice that 还要注意

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

is true for me. 对我来说是对的。

Edit: 编辑:

I noticed that on my Windows-Only installation, HttpApplicationGatewayListenAddress has value 0 in the FabricHostSettings.xml 我注意到在我的Windows-Only安装中,HttpApplicationGatewayListenAddress在FabricHostSettings.xml中的值为0

<Parameter Name="HttpGatewayListenAddress" Value="19080" />
<Parameter Name="HttpGatewayProtocol" Value="http" />
<Parameter Name="HttpApplicationGatewayListenAddress" Value="0" />
<Parameter Name="HttpApplicationGatewayProtocol" Value="" />

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

相关问题 从Azure网站访问本地Web服务 - Accessing on-premises web service from Azure websites 如何通过长初始化将Azure Cloud Service明智地转换为Azure Service Fabric服务? - How would I sensibly convert an Azure Cloud Service with long initialization into an Azure Service Fabric service? Azure Service Fabric中WCF服务的HTTP端点 - HTTP Endpoint for WCF Service in Azure Service Fabric 如何配置代理设置? - How to configure proxy setting? 将soap服务(.asmx)与Azure Service结构一起使用 - Using soap services(.asmx) with Azure Service fabric 如何创建Azure Web服务并使用现有的SQL数据库 - How to create an azure web service and use existing sql database 如何为JBoss 4中运行的Web Service客户端配置HTTP代理? - How can I configure the HTTP proxy for a Web Service client running in JBoss 4? 如何在 WSO2 ESB 4.9.0 策略文件中为 Digest 启用代理服务安全 - How to enable proxy service security in WSO2 ESB 4.9.0 Policy file for Digest 如何为ASP.NET Web服务配置代理类以灵活地部署到生产环境 - How to configure a proxy class for an ASP.NET web service for flexible deployment to production 如何配置WCF Azure云服务,以便无需脱机即可对其进行更新? - How to configure WCF Azure cloud service so that it can be updated without taking it offline?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM