将应用程序旧版本 运行 与 Azure Service Fabric 中的新版本并排放置

Keep application old version running side-by-side with the newer version in Azure Service Fabric

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

1.0 1.1 ....

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

可以吗?

谢谢!

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

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

我已经使用示例应用程序 WordCount(http://aka.ms/servicefabric-wordcountapp). To see more details how download the app and deploy it, see 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 文档团队,这个主题最好放在 public docs