Questo contenuto non è disponibile nella lingua selezionata.

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

  1. 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
Copy to Clipboard Toggle word wrap

16.1. Displaying node attributes as pcs commands

You can export node attributes as a series of pcs commands by using the --output-format=cmd option. This is useful for scripting, automation, or replicating the same configuration on a different system.

Note

You can display the configured node attributes in one of three formats:

  • text: Displays the output in plain text. This is the default format.
  • json: Displays the output in a machine-readable JSON format, which is useful for scripting and automation.
  • cmd: Displays the output as a series of pcs commands, which you can use to recreate the same node attributes on a different system.
  • To display the configured node attributes as a series of pcs commands:

    # pcs node attribute --output-format=cmd
    Copy to Clipboard Toggle word wrap

    Example output

    pcs node attribute node1 location=rack1
    pcs node attribute node2 location=rack2
    Copy to Clipboard Toggle word wrap

Torna in cima
Red Hat logoGithubredditYoutubeTwitter

Formazione

Prova, acquista e vendi

Community

Informazioni sulla documentazione di Red Hat

Aiutiamo gli utenti Red Hat a innovarsi e raggiungere i propri obiettivi con i nostri prodotti e servizi grazie a contenuti di cui possono fidarsi. Esplora i nostri ultimi aggiornamenti.

Rendiamo l’open source più inclusivo

Red Hat si impegna a sostituire il linguaggio problematico nel codice, nella documentazione e nelle proprietà web. Per maggiori dettagli, visita il Blog di Red Hat.

Informazioni su Red Hat

Forniamo soluzioni consolidate che rendono più semplice per le aziende lavorare su piattaforme e ambienti diversi, dal datacenter centrale all'edge della rete.

Theme

© 2026 Red Hat