Affinity Management enables a centralized definition and enforcement of node affinities across a Fabric cluster. Instead of editing the node.id file on each node separately, you can define the affinity rules once - per DC or for the entire cluster - and let Fabric distribute and maintain them automatically via a dedicated Affinity Management Job. This feature is available starting from Fabric V8.5.
For an introduction to the affinity concept and its usage by jobs and batch processes, see the Job & Batch Processes Affinity article.
Affinity can be configured across a cluster using one of the following approaches:
Affinity Management supports the existing affinity format - <name>:<recommended> <max> - as well as the following special affinities:
The below notations are supported in the node.id file:
a1:1 2 - full notation: affinity a1 with a recommended value of 1 and a maximum of 2.a2:3 - short notation, equivalent to a2:3:3.a3 - unlimited affinity.blue - a node group (color) name, e.g. group blue. A group name is also a valid affinity for jobs. However, recommended or max values cannot be set on a group.IGNORE_AFFINITY_RULES - the node is excluded from the affinity manager's scope.There are two types of node groups:
The global affinity definition is a JSON object that can be set either manually - using a Fabric command - or via the dedicated Admin UI section. If the JSON object is not set, no affinity management takes place.
The JSON structure is as follows:
<affinity> [<recommended> [<max>]] format, as defined in the node.id file.For example:
set_global affinity_rules='{"DC1":{"blue_new":{"count":1,"affinities":[{"affinity":"aff_b_22","recommended":2,"max":3},{"affinity":"Blue_new","recommended":5}]},"green2_11":{"count":1,"affinities":[{"affinity":"gr_11"}]}},"default_group":{"affinities":[{"affinity":"default_1","recommended":1,"max":4}]}}';
The Affinity Management Job applies the global affinity rules on the nodes. One job runs per DC, performing the following steps:
IGNORE_AFFINITY_RULES.On startup, a node uses its existing node.id file. The file is updated once the Affinity Management Job runs.
The Admin UI enables defining the affinity settings across the entire cluster. Note that:
@Reset@ string as an empty rule (see the set_global reset_affinity_rules command below).
The following Fabric commands were added or updated to support Affinity Management.
Sets the global affinity definition. The command validates the provided rules, sets the definition if valid, and starts one Affinity Management Job per each Fabric DC:
set_global affinity_rules='{"DC1":{"blue_new":{"count":1,"affinities":[{"affinity":"aff_b_22","recommended":2,"max":3},{"affinity":"Blue_new","recommended":5}]},"green2_11":{"count":1,"affinities":[{"affinity":"gr_11"}]}},"default_group":{"affinities":[{"affinity":"default_1","recommended":1,"max":4}]}}';
When the command is executed with no rules, all jobs are deactivated and an empty rule is written to the global definition. All existing affinity settings are left as is.
To reset the affinity rules, run:
set_global reset_affinity_rules;
This command writes a special global value (@Reset@) as a rule, deletes all affinities from all live nodes and exits.
Presents the currently defined global affinity rules:
list affinity_rules;
Sets, updates or deletes affinity rules on the current node (the node defined by the command's connection):
SET NODE_AFFINITY "aff1:1:4" -- Set
SET NODE_AFFINITY "aff1:2:4" -- Update
SET NODE_AFFINITY "aff1:0:4" -- Delete
Describes all the cluster nodes with their detailed affinity list, including the recommended and max values:
clusterstatus NODE_AFFINITY_STATUS;
Applies the global affinity rules on the current DC:
startjob NODE_AFFINITY_COORDINATOR_JOB NAME='affinity3';
If no rules are defined, the job does nothing and exits.
Note that usually the job starts automatically upon setting the cluster affinity rules, so there is no need to run it manually.
Following an upgrade, the new node.id file comes empty, although it can include default settings.
Add the existing job types - such as iidFinder - and the existing cluster configuration using the Admin UI or in the other provided ways.
Affinity Management enables a centralized definition and enforcement of node affinities across a Fabric cluster. Instead of editing the node.id file on each node separately, you can define the affinity rules once - per DC or for the entire cluster - and let Fabric distribute and maintain them automatically via a dedicated Affinity Management Job. This feature is available starting from Fabric V8.5.
For an introduction to the affinity concept and its usage by jobs and batch processes, see the Job & Batch Processes Affinity article.
Affinity can be configured across a cluster using one of the following approaches:
Affinity Management supports the existing affinity format - <name>:<recommended> <max> - as well as the following special affinities:
The below notations are supported in the node.id file:
a1:1 2 - full notation: affinity a1 with a recommended value of 1 and a maximum of 2.a2:3 - short notation, equivalent to a2:3:3.a3 - unlimited affinity.blue - a node group (color) name, e.g. group blue. A group name is also a valid affinity for jobs. However, recommended or max values cannot be set on a group.IGNORE_AFFINITY_RULES - the node is excluded from the affinity manager's scope.There are two types of node groups:
The global affinity definition is a JSON object that can be set either manually - using a Fabric command - or via the dedicated Admin UI section. If the JSON object is not set, no affinity management takes place.
The JSON structure is as follows:
<affinity> [<recommended> [<max>]] format, as defined in the node.id file.For example:
set_global affinity_rules='{"DC1":{"blue_new":{"count":1,"affinities":[{"affinity":"aff_b_22","recommended":2,"max":3},{"affinity":"Blue_new","recommended":5}]},"green2_11":{"count":1,"affinities":[{"affinity":"gr_11"}]}},"default_group":{"affinities":[{"affinity":"default_1","recommended":1,"max":4}]}}';
The Affinity Management Job applies the global affinity rules on the nodes. One job runs per DC, performing the following steps:
IGNORE_AFFINITY_RULES.On startup, a node uses its existing node.id file. The file is updated once the Affinity Management Job runs.
The Admin UI enables defining the affinity settings across the entire cluster. Note that:
@Reset@ string as an empty rule (see the set_global reset_affinity_rules command below).
The following Fabric commands were added or updated to support Affinity Management.
Sets the global affinity definition. The command validates the provided rules, sets the definition if valid, and starts one Affinity Management Job per each Fabric DC:
set_global affinity_rules='{"DC1":{"blue_new":{"count":1,"affinities":[{"affinity":"aff_b_22","recommended":2,"max":3},{"affinity":"Blue_new","recommended":5}]},"green2_11":{"count":1,"affinities":[{"affinity":"gr_11"}]}},"default_group":{"affinities":[{"affinity":"default_1","recommended":1,"max":4}]}}';
When the command is executed with no rules, all jobs are deactivated and an empty rule is written to the global definition. All existing affinity settings are left as is.
To reset the affinity rules, run:
set_global reset_affinity_rules;
This command writes a special global value (@Reset@) as a rule, deletes all affinities from all live nodes and exits.
Presents the currently defined global affinity rules:
list affinity_rules;
Sets, updates or deletes affinity rules on the current node (the node defined by the command's connection):
SET NODE_AFFINITY "aff1:1:4" -- Set
SET NODE_AFFINITY "aff1:2:4" -- Update
SET NODE_AFFINITY "aff1:0:4" -- Delete
Describes all the cluster nodes with their detailed affinity list, including the recommended and max values:
clusterstatus NODE_AFFINITY_STATUS;
Applies the global affinity rules on the current DC:
startjob NODE_AFFINITY_COORDINATOR_JOB NAME='affinity3';
If no rules are defined, the job does nothing and exits.
Note that usually the job starts automatically upon setting the cluster affinity rules, so there is no need to run it manually.
Following an upgrade, the new node.id file comes empty, although it can include default settings.
Add the existing job types - such as iidFinder - and the existing cluster configuration using the Admin UI or in the other provided ways.