为什么在升级中无法更改放置限制? [英] Why isn't it possible to change placement constraints in an upgrade?

查看:69
本文介绍了为什么在升级中无法更改放置限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Azure Service Fabric群集中正在运行无状态ASP.NET Core(RC1)服务.它具有以下清单:

I have a stateless ASP.NET Core (RC1) service running in my Azure Service Fabric cluster. It has the following manifest:

<ServiceManifest Name="MyServicePkg" Version="1.0.2" ...>
   <ServiceTypes>
      <StatelessServiceType ServiceTypeName="MyServiceType" />
   </ServiceTypes>
   ...
</ServiceManifest>

我的集群配置了展示位置属性.我有5台服务器的"nodeType =后端"和3台服务器的"nodeType =前端".

My cluster is configured with placement properties. I have 5 servers with "nodeType=Backend" and 3 servers with "nodeType=Frontend".

我想升级我的服务并指定它只能放在后端"节点上.这是我更新的清单:

I would like to upgrade my Service and specify that it may only be placed on "Backend" nodes. This is my updated manifest:

<ServiceManifest Name="MyServicePkg" Version="1.0.3" ...>
   <ServiceTypes>
      <StatelessServiceType ServiceTypeName="MyServiceType">
          <PlacementConstraints>(nodeType==Backend)</PlacementConstraints>
      </StatelessServiceType>
   </ServiceTypes>
   ...
</ServiceManifest>

但是,如果现在执行升级,则会出现以下错误:

However, if I now execute the upgrade, I get the following error:

Start-ServiceFabricApplicationUpgrade:默认服务描述 不得在升级过程中进行修改.修改后的默认服务: 结构:/MyApp/MyService

Start-ServiceFabricApplicationUpgrade : Default service descriptions must not be modified as part of upgrade. Modified default service: fabric:/MyApp/MyService

为什么不能通过升级更改约束?

Why isn't it possible to change the constraints with an upgrade?

我是否必须删除并重新创建服务?对我来说,这似乎非常麻烦,因为它会导致状态服务的停机时间和数据丢失.

Would I have to delete and re-create the service? This would seem extremely problematic to me because it would result in downtime and data loss for stateful services.

推荐答案

实际上,有一种相当简单的方法,而无需编写一堆代码即可在结构集群上手动定义应用程序.

There's actually a fairly easy way to do this without having to write a bunch of code to manually define the application on the fabric cluster.

虽然可以在服务清单中声明放置约束,但也可以在应用程序清单中声明它们.应用程序清单中声明的​​所有内容都将覆盖服务清单中的内容.通过应用程序清单中的设置,然后可以使用参数基于要针对特定​​部署的参数文件来更改值.

While you can declare the placement constraints in the service manifest, you can also declare them in the application manifest. Anything declared in the application manifest will override what's in the service manifest. And with the setting in the application manifest, you can then use parameters to alter the values based on the parameter file you want to a specific deployment.

我刚刚撰写了博客文章详细讨论了这种方法.希望对你有帮助. :)

I've just written up a blog post that discusses this approach in greater detail. I hope you find it useful. :)

这篇关于为什么在升级中无法更改放置限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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