【问题标题】:Keep application old version running side-by-side with the newer version in Azure Service Fabric在 Azure Service Fabric 中保持应用程序旧版本与新版本并行运行
【发布时间】:2016-11-01 10:59:09
【问题描述】:

我需要在 Service Fabric 上同时运行多个版本的应用程序。

1.0 1.1 ....

我需要让它们保持在线,而不是更新和替换版本。

有可能吗?

谢谢!

【问题讨论】:

    标签: azure azure-service-fabric


    【解决方案1】:

    是的,只要您有不同的应用程序名称,您就可以这样做。应用程序名称在 Service Fabric 应用程序 (.sfproj) 项目的应用程序参数文件中指定。当 Visual Studio 调用 Service Fabric 的 New-ServiceFabricApplication PowerShell cmdlet 时,将使用该应用程序名称值。这意味着您可以在集群中运行具有相同应用程序类型和版本的两个应用程序,只要它们具有不同的应用程序名称即可。或者,如果您愿意,您可以拥有不同版本的应用程序类型。只要他们有不同的应用程序名称,没关系;它们被视为独特的应用程序。

    【讨论】:

      【解决方案2】:

      正如 Matt Thalman 所说,可以在 Service Fabric 集群中运行同一应用的不同版本。

      我已经使用示例应用 WordCount(http://aka.ms/servicefabric-wordcountapp) 进行了测试。要了解如何下载和部署应用程序的更多详细信息,请参阅https://azure.microsoft.com/en-us/documentation/articles/service-fabric-get-started-with-a-local-cluster/

      我已将 WordCount 复制为 WordCountV1 和 WordCountV2。

      然后我更改了 /ApplicationManifest.xml 以在每个包上具有不同的 ApplicationTypeVersion。在集群管理器中显示应用程序的当前版本是必要的,因为这两个应用程序都按 ApplicationTypeName 分组显示。

      V1

      <ApplicationManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ApplicationTypeName="WordCount" ApplicationTypeVersion="1.0.0" xmlns="http://schemas.microsoft.com/2011/01/fabric">
      

      V2

      <ApplicationManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ApplicationTypeName="WordCount" ApplicationTypeVersion="2.0.0" xmlns="http://schemas.microsoft.com/2011/01/fabric">
      

      然而,我已经更改了 /WordCountWebServicePkg/Code/wwwroot/index.html 文件以在两个包上具有不同的内容。

      需要指定不同的端点,所以我在两个包中更改了文件 /WordCountWebServicePkg/ServiceManifest.xml 以响应不同的端口

      V1

      <Endpoint Name="ServiceEndpoint" Type="Input" Protocol="http" Port="8081" />
      

      V2

      <Endpoint Name="ServiceEndpoint" Type="Input" Protocol="http" Port="8082" />
      

      最后一步是使用不同的ApplicationName来发布包:

      V1

      Publish-NewServiceFabricApplication -ApplicationPackagePath c:\ServiceFabric\WordCountV1.sfpkg -App
      licationName "fabric:/WordCountV1"
      

      V2

      Publish-NewServiceFabricApplication -ApplicationPackagePath c:\ServiceFabric\WordCountV2.sfpkg -App
      licationName "fabric:/WordCountV2"
      

      这两个应用程序是并行发布的,因此我们可以更好地控制版本更新。

      V1

      http://localhost:8081/

      V2

      http://localhost:8082/

      希望对你有帮助!

      PS:Azure Service Fabric 文档团队,这个主题最好出现在公共文档中

      【讨论】:

      • 这太棒了。 2 年后,你会采取同样的方法吗?
      猜你喜欢
      • 1970-01-01
      • 2019-05-10
      • 1970-01-01
      • 1970-01-01
      • 2021-01-23
      • 2019-04-29
      • 2018-05-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多