配置 Service Fabric 服务的群集资源管理器设置Configuring cluster resource manager settings for Service Fabric services

Service Fabric 群集资源管理器允许精细地控制用于管控每个独立命名服务的规则。The Service Fabric Cluster Resource Manager allows fine-grained control over the rules that govern every individual named service. 每个命名服务均可为它在群集中的分配方式指定规则。Each named service can specify rules for how it should be allocated in the cluster. 每个命名的服务还可以定义需要报告的一组指标,包括其对该服务的重要性。Each named service can also define the set of metrics that it wants to report, including how important they are to that service. 配置服务的过程划分为三个不同的任务:Configuring services breaks down into three different tasks:

  1. 配置放置约束Configuring placement constraints
  2. 配置指标Configuring metrics
  3. 配置高级放置策略和其他规则(不太常见)Configuring advanced placement policies and other rules (less common)

放置约束Placement constraints

放置约束可用来控制服务实际可在群集中的哪些节点上运行。Placement constraints are used to control which nodes in the cluster a service can actually run on. 通常为特定的命名服务实例或受限于在特定类型节点上运行的类型的所有服务。Typically a particular named service instance or all services of a given type constrained to run on a particular type of node. 放置约束是可扩展的。Placement constraints are extensible. 创建服务时,可以按照节点类型定义任何属性组,然后为其选择约束。You can define any set of properties per node type, and then select for them with constraints when creating services. 运行时,还可以更改服务的放置约束。You can also change a service's placement constraints while it is running. 这样,可以对群集或服务要求的更改进行响应。This allows you to respond to changes in the cluster or the requirements of the service. 还可以在群集中动态更新给定节点的属性。The properties of a given node can also be updated dynamically in the cluster. 有关放置约束以及如何对其进行配置的详细信息,请参阅此文More information on placement constraints and how to configure them can be found in this article

指标Metrics

指标是给定命名服务需要的资源集。Metrics are the set of resources that a given named service needs. 服务的指标配置包括:默认情况下,该服务的每个有状态副本或无状态实例消耗多少该资源。A service's metric configuration includes how much of that resource each stateful replica or stateless instance of that service consumes by default. 指标还包括一个权重,表示该指标对于服务的重要程度,以便于权衡利弊。Metrics also include a weight that indicates how important balancing that metric is to that service, in case tradeoffs are necessary.

高级放置规则Advanced placement rules

其他类型的放置规则在较不常见的方案中有用。There are other types of placement rules that are useful in less common scenarios. 下面是一些示例:Some examples are:

  • 有助于在地理上分发群集的约束Constraints that help with geographically distributed clusters
  • 某些应用程序体系结构Certain application architectures

其他放置规则通过相关性或策略进行配置。Other placement rules are configured via either Correlations or Policies.

后续步骤Next steps

  • 指标是 Service Fabric 群集资源管理器在群集中管理消耗和容量的方式。Metrics are how the Service Fabric Cluster Resource Manger manages consumption and capacity in the cluster. 若要详细了解指标及其配置方式,请查看此文To learn more about metrics and how to configure them, check out this article
  • 相关性是可以针对服务配置的一种模式。Affinity is one mode you can configure for your services. 它并不常用,但如果需要,可以参阅此处It is not common, but if you need it you can learn about it here
  • 可以在服务上配置许多不同的放置规则以处理其他方案。There are many different placement rules that can be configured on your service to handle additional scenarios. 可以在此处了解这些不同的放置策略You can find out about those different placement policies here
  • 从头开始并获取 Service Fabric 群集 Resource Manager 简介Start from the beginning and get an Introduction to the Service Fabric Cluster Resource Manager
  • 若要了解群集 Resource Manager 如何管理和均衡群集中的负载,请查看有关均衡负载的文章To find out about how the Cluster Resource Manager manages and balances load in the cluster, check out the article on balancing load
  • 群集 Resource Manager 提供许多用于描述群集的选项。The Cluster Resource Manager has many options for describing the cluster. 若要详细了解这些选项,请查看这篇描述 Service Fabric 群集的文章To find out more about them, check out this article on describing a Service Fabric cluster