Mapping Azure Service Fabric services to a certain node type

不羁岁月 提交于 2019-12-21 13:01:40

问题


Creating services (or actors in the case of Reliable Actors) in the Service Fabric application VS template is effortless. Defining node types in the Azure portal is also easy. But how do you map a service/actor to run on a specific node type?


回答1:


You can do that using placement constraints.

More information on that can be found in the "Placement constraints and node properties" section of this article.

In short, you'd need to set placement properties on your cluster and then set placement constraints on the service using StatefulServiceDescription.PlacementConstraints.




回答2:


Here is declarative way to do it in ApplicationManifest.xml:

<ServiceTypes>
  <StatelessServiceType ServiceTypeName="Stateless1">
    <PlacementConstraints>(NodeTypeName==BackEnd)</PlacementConstraints>
  </StatelessServiceType>
</ServiceTypes>

And you can use parameters to use different constraints in different environments:

<Service Name="Stateless1">
  <StatelessService ServiceTypeName="Stateless1Type" InstanceCount="[Stateless1_InstanceCount]">
    <SingletonPartition />
    <PlacementConstraints>[Stateless1_PlacementConstraints]</PlacementConstraints>
  </StatelessService>
</Service>

Stateless1_PlacementConstraints can be redefined in application parameters files (Cloud.xml, Local5Node.xml etc).

More details: https://brentdacodemonkey.wordpress.com/2016/09/11/placement-constraints-with-service-fabric/



来源:https://stackoverflow.com/questions/36726231/mapping-azure-service-fabric-services-to-a-certain-node-type

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!