[英]Mapping Azure Service Fabric services to a certain node type
在Service Fabric应用程序VS模板中创建服务(或Reliable Actors中的actor)是毫不费力的。 在Azure门户中定义节点类型也很容易。 但是,如何映射服务/ actor以在特定节点类型上运行?
您可以使用放置约束来实现。
上的更多信息可在“放置约束和节点属性”的一节中找到这种物品。
简而言之,您需要在集群上设置放置属性,然后使用StatefulServiceDescription.PlacementConstraints在服务上设置放置约束。
这是在ApplicationManifest.xml中执行它的声明性方法:
<ServiceTypes>
<StatelessServiceType ServiceTypeName="Stateless1">
<PlacementConstraints>(NodeTypeName==BackEnd)</PlacementConstraints>
</StatelessServiceType>
</ServiceTypes>
您可以使用参数在不同的环境中使用不同的约束:
<Service Name="Stateless1">
<StatelessService ServiceTypeName="Stateless1Type" InstanceCount="[Stateless1_InstanceCount]">
<SingletonPartition />
<PlacementConstraints>[Stateless1_PlacementConstraints]</PlacementConstraints>
</StatelessService>
</Service>
可以在应用程序参数文件(Cloud.xml,Local5Node.xml等)中重新定义Stateless1_PlacementConstraints。
更多细节: https : //brentdacodemonkey.wordpress.com/2016/09/11/placement-constraints-with-service-fabric/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.