限制在所有服务结构节点中的一个服务实例

Restrict to one service instance within all the service fabric nodes

我有一个无状态服务结构服务,它基本上在指定的时间间隔进行批处理。因此,拥有多个实例会使事情变得复杂,因为每个实例都会尝试执行相同的批处理作业。

我非常想 运行 单个批处理。目前我已经在 ApplicationManifest.xml 中将此服务的 InstanceCount 设置为 1。如果有多个节点会怎样?我还会有此服务的单个实例吗?或者我如何确保此服务具有单个实例,而不管 Nodes/Partitions 的数量?

Currently I have set the InstanceCount of this service to 1 in ApplicationManifest.xml. What will happen if there are multiple nodes? Would I still have single instance of this service?

如果有多个节点,则只有一个节点包含主要的活动实例。其他节点可能托管将在需要时接管的副本,例如当主实例所在的节点出现故障时。

how do I make sure this service has single instance regardless or number of Nodes/Partitions?

我们在第一部分的回答中涵盖了多个节点。关于分区:无状态服务只有1个分区,所以它对你的问题没有作用。

更多背景知识material阅读the docs about the service lifecycle and about replica lifecycles