Chapter 16. Configuring node-specific values using node attributes
Chapter 16. Configuring node-specific values using node attributes Pacemaker supports the configuration of node-specific values, which you specify using node attributes . You can use node attributes to track information associated with a node. For example, you can define node attributes for how much RAM and disk space each node has, which OS each node uses, or which server room rack each node is in. There are three primary uses for node attributes: In Pacemaker rules for the cluster configuration For example, you can set a node attribute named department to accounting or IT on each node, depending on which department that node is dedicated to. You can then configure a location rule to ensure that an accounting database runs only on servers where department is set to accounting . For information about node attribute expressions in Pacemaker rules, see Pacemaker rules . In resource agents for the specific resource requirements For example, a database resource agent can use a node attribute to track the latest replication position for use in a promote action. In external scripts for use outside Pacemaker For example, you can set data-center and rack attributes for each node, for use by an external inventory script. Defining a node attribute You define a node attribute with the pcs node attribute command. A node attribute has a name and a value, and can have a distinct value for each node. When you define a node attribute with the pcs node attribute command, the node attribute is permanent . Permanent node attributes keep their values even when the cluster restarts on a node. Note You can define a transient node attribute, which is kept in the CIB's status section, and does not remain when the cluster stops on the node. For information about defining transient node attributes, see the crm_attribute (8) and attrd_updater (8) man pages on your system. Procedure Run the following commands to define a node attribute with the name rack for node1 and node2 , setting a value of 1 for the rack attribute of node1 and a value of 2 for the rack attribute of node2 .
pcs node attribute node1 rack=1 pcs node attribute node2 rack=2