15장. 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.

참고

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

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.

참고

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

    Example output

    pcs node attribute node1 location=rack1
    pcs node attribute node2 location=rack2

Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 문서 정보

Legal Notice

Theme

© 2026 Red Hat
맨 위로 이동