Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Pacemaker Command Quick Reference

Matt Kereczman
Version 0.9, 2020-05-20
Pacemaker Command Quick Reference: 1. Overview of the Cluster

This quick reference includes the most commonly used shell commands for administrating a Pacemaker cluster.
Commands for crmsh and pcs can be used interchangeably.

1. Overview of the Cluster


For an overview of the cluster and cluster managed services, use the following command:

# crm_mon -1r

For a continuously updated view of the cluster and cluster managed services, omit the -1 option:

# crm_mon -r

2. Managing Cluster Resources


Stopping a resource managed by the cluster:

# crm resource stop <resource>


  -- or --
# pcs resource disable <resource>

Starting a resource managed by the cluster:

# crm resource start <resource>


  -- or --
# pcs resource enable <resource>

Migrating (moving) cluster resources to a specific node:

# crm resource move <resource> <target-node>


  -- or --
# pcs resource move <resource> <target-node>

Resources can also be moved away from, or kept off of, a specific node:

# crm resource ban <resource> <banned-node>


  -- or --
# pcs resource ban <resource> <banned-node>

Moving/banning resources places a location constraint in the cluster configuration. You must
 remember to remove the constraint using the appropriate unmove / clear command after the
resource has moved.

To remove the migration constraint from the cluster after the service has been migrated:

1
Pacemaker Command Quick Reference: 3. Managing Cluster Nodes

# crm resource unmove <resource>


  -- or --
# pcs resource clear <resource>

Creating a new cluster resource:

# crm configure primitive <resource> <resource-agent> \


  params <resource-parameter>=<parameter-value \
  op <op-name> interval=<op-interval>s timeout=<op-timeout>s
  -- or --
# pcs resource create <resource> <resource-agent> \
  <resource-parameter>=<parameter-value> \
  op <op-name> interval=<op-interval>s timeout=<op-timeout>s

Removing a cluster resource:

# crm configure delete <resource>


  -- or --
# pcs resource delete <resource>


When deleting a resource using crmsh, you must first stop the resource. crmsh will not delete a
resource while it’s running. Conversely, pcs will stop a running resource if you delete it.

3. Managing Cluster Nodes


To put a cluster node into standby mode, therefore marking it ineligible for running cluster resources:

# crm node standby <node>


  -- or --
# pcs node standby <node>

To return a cluster node to online mode, therefore marking it eligible for running cluster resources:

# crm node online <node>


  -- or --
# pcs node unstandby <node>

To put the entire Pacemaker cluster into maintenance mode:

# crm configure property maintenance-mode=true


  -- or --
# pcs property set maintenance-mode=true

Returning the cluster to normal operations after putting it into maintenance mode:

2
Pacemaker Command Quick Reference: 4. Cleanup Resource Failures

# crm configure property maintenance-mode=false


  -- or --
# pcs property set maintenance-mode=true=false

4. Cleanup Resource Failures


To reset a cluster resource’s failcount, therefore triggering the cluster to reprobe the resource and attempt a resource
recovery:

# crm resource cleanup <resource>


  -- or --
# pcs resource cleanup <resource>

5. Using Shell Documentation


To get help for specific cluster sub-shells:

# crm <subshell> help


  -- or --
# pcs <subshell> help

For a full list of sub-shells or general help, simply:

# crm help
  -- or --
# pcs help

6. Resource Agent Documentation


For a list of all currently installed Pacemaker resource agents:

# crm ra list <class>


  -- or --
# pcs resource agents <class>
# pcs resource agents

 valid class options at the time of writing are: ocf, lsb, service, and systemd

To see documentation for a specific Pacemaker resource agent, including a full list of it’s parameters and default
operation settings:

# crm ra info <resource-agent>


  -- or --
# pcs resource describe <resource-agent>

3
Pacemaker Command Quick Reference: 7. Editing the Cluster Configuration

7. Editing the Cluster Configuration


To edit the cluster configuration as a whole using crmsh:

# crm
crm(live/node)# cib new staged-cib
crm(staged-cib/node)# configure edit
-- opens an editor --
-- write and quit to save changes --
crm(staged-cib/node)# cib commit staged-cib
crm(staged-cib/node)# quit

To edit the cluster configuration as a whole using pcs:

# pcs cluster cib staged-cib


# vim staged-cib
-- opens cib in VIM --
-- write and quit to save changes --
# pcs cluster cib-push staged-cib

In both examples the name, staged-cib, was used but could be anything. In the crmsh example,
 whatever name is used will be shown in the prompt to inform the user they are no longer
performing actions on the live configuration.

Appendix A: Additional Information and Resources


• LINBIT’s GitHub Organization: https://github.com/LINBIT/
• Join LINBIT’s Community on Slack: https://www.linbit.com/join-the-linbit-drbd-linstor-slack/
• The DRBD® and LINSTOR® User’s Guide: https://docs.linbit.com/
• The DRBD® and LINSTOR® Mailing Lists: https://lists.linbit.com/

◦ drbd-announce: Announcements of new releases and critical bugs found


◦ drbd-user: General discussion and community support
◦ drbd-dev: Coordination of development
• We’re also on IRC. You can find us on Freenode.net in #drbd.

Appendix B: Legalese
B.1. Trademark Notice
DRBD® and LINBIT® are trademarks or registered trademarks of LINBIT in Austria, the United States, and other
countries. Other names mentioned in this document may be trademarks or registered trademarks of their respective
owners.

B.2. License Information


The text and illustrations in this document are licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported
license ("CC BY-SA").

4
Pacemaker Command Quick Reference: B.2. License Information

• A summary of CC BY-NC-SA is available at http://creativecommons.org/licenses/by-nc-sa/3.0/.


• The full license text is available at http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode.
• In accordance with CC BY-NC-SA, if you modify this document, you must indicate if changes were made. You
may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use

You might also like