CRM(8)
π CRM(8) β the crmsh girlies' guide π
crm(8) Β· crmsh documentation Β· Pacemaker command line interface
okay bestie, welcome to the crm page, you're gonna love her π
β¨ NAME β¨
crm β the Pacemaker command line interface for configuration and management π«Ά
πΈ SYNOPSIS πΈ
crm [OPTIONS] [SUBCOMMAND ARGS...]
π¦ DESCRIPTION π¦
So crm is a command-line cluster configuration and management tool, no cap. Her whole goal? To help you out as much as possible with configuring and maintaining Pacemaker-based High Availability clusters. She's literally built for it π
Wanna know more about Pacemaker itself? Go peek at http://clusterlabs.org/ β¨
crm works two ways, and she slays at both: as a command-line tool you call straight from your system shell, and as an interactive shell with extensive tab completion and help. Iconic behavior honestly π
Her main character energy is providing a simplified and consistent interface to Pacemaker β but she also hands you tools for creating and configuring High Availability clusters from scratch. Curious about that side of her? Check out the cluster section below π
Basically crm can manage every single aspect of configuring and maintaining a cluster. She gives you:
- a simplified line-based syntax layered on top of the XML configuration format Pacemaker uses
- commands for starting and stopping resources
- tools for exploring the history of a cluster, log scraping included
- a set of cluster scripts that are useful for automating the setup and installation of services on the cluster nodes
And here's the vibe check you need to remember: crm is line oriented β every command has to start and finish on the same line. BUT you can use a continuation character (\) to write one command across two or more lines. That continuation character shows up a lot when displaying configurations, so don't be confused when you see it π
π OPTIONS π
-f,--file=FILEβ load commands from the file you give her. If you pass a dash-instead of a filename,crmreads commands from the shell standard input (stdin) π-c,--cib=CIBβ start the session using that shadow CIB file. Same thing as runningcib use <CIB>β¨-D,--display=OUTPUT_TYPEβ pick one of the output options:plain,color-always,color, oruppercase. Default iscolorif your terminal emulation supports colors β otherwise you getplain. Choose wisely π-F,--forceβ makescrmgo ahead and apply changes in places where she'd normally ask you to confirm first. Genuinely mostly useful in scripts, and use her with care, fr fr β οΈ-w,--waitβ makescrmwait for the cluster transition to finish (like, for the changes to actually take effect) after each processed line π-H,--history=DIR|FILE|SESSIONβ a directory or file containing a cluster report to load into the history commands, or the name of a previously saved history session π¦-h,--helpβ print the help page π«Ά--versionβ print crmsh version and build information (the Mercurial Hg changeset hash) π-d,--debugβ print verbose debugging information π-R,--regression-testsβ turns on extra verbose trace logging used by the regression tests. Logs all external calls made by crmsh π--scriptdir=DIRβ an extra directory wherecrmlooks for cluster scripts, or a list of directories separated by semi-colons (e.g./dir1;/dir2;etc.) π-o,--opt=OPTION=VALUEβ set a crmsh option temporarily. If the options get saved usingoptions save, then the value you passed here gets saved too. You can set multiple options by using-omultiple times π
π INTRODUCTION π
This part of the user guide covers the general tea about the user interface and describes some of crmsh's features in detail. Let's get into it β¨
π User interface π
crmsh's whole purpose is giving you a simple yet powerful interface to the cluster stack. There are two main modes of operation for the crmsh user interface:
- Command line (single-shot) use β use
crmas a regular UNIX command from your usual shell.crmhas full bash completion built in, so using her this way should feel as comfy and familiar as using any other command-line tool π - Interactive mode β call
crmwith no arguments, or call it with only a sublevel as the argument, andcrmenters interactive mode. In this mode she acts as her own command shell, which remembers which sublevel you're currently in and lets you rapidly and conveniently execute a bunch of commands within the same sublevel. This mode also has full tab completion, plus built-in interactive help and syntax highlighting π
Here are a few examples of using crm both as a command-line tool and as an interactive shell:
Command line (one-shot) use:.
# crm resource stop www_app
Interactive use:.
# crm
crm(live)# resource
crm(live)resource# unmanage tetris_1
crm(live)resource# up
crm(live)# node standby node4
Cluster configuration:.
# crm configure<<EOF
#
# resources
#
primitive disk0 iscsi \
params portal=192.168.2.108:3260 target=iqn.2008-07.com.suse:disk0
primitive fs0 Filesystem \
params device=/dev/disk/by-label/disk0 directory=/disk0 fstype=ext3
primitive internal_ip IPaddr params ip=192.168.1.101
primitive apache apache \
params configfile=/disk0/etc/apache2/site0.conf
primitive apcfence stonith:apcsmart \
params ttydev=/dev/ttyS0 hostlist="node1 node2" \
op start timeout=60s
primitive pingd ocf:pacemaker:ping \
params name=pingd dampen=5s multiplier=100 host_list="r1 r2"
#
# monitor apache and the UPS
#
monitor apache 60s:30s
monitor apcfence 120m:60s
#
# cluster layout
#
group internal_www \
disk0 fs0 internal_ip apache
clone fence apcfence \
meta globally-unique=false clone-max=2 clone-node-max=1
clone conn pingd \
meta globally-unique=false clone-max=2 clone-node-max=1
location node_pref internal_www \
rule 50: #uname eq node1 and \
defined pingd
#
# cluster properties
#
property stonith-enabled=true
commit
EOF
The crm interface is hierarchical, with commands organized into separate levels by functionality. Want to list the available levels and commands? Either execute help <level>, or β if you're at the top level of the shell β just type help and she'll give you an overview of all available levels and commands π¦
That (live) string in the crm prompt means the CIB currently in use is the cluster live configuration. You can also work with what we call shadow CIBs β these are separate, inactive configurations stored in files, which you can apply at any time, and that replaces the live configuration π«
π§ Tab completion π§
crm makes extensive use of tab completion, and the completion is both static (like for crm commands) and dynamic. The dynamic kind takes into account the current status of the cluster or info from installed resource agents. Sometimes completion can even give you short help on resource parameters. Obsessed. Here are a few examples:
crm(live)resource# <TAB><TAB>
ban demote maintenance param scores trace
cd failcount manage promote secret unmanage
cleanup help meta quit start untrace
clear locate move refresh status up
constraints ls operations restart stop utilization
crm(live)configure# primitive fence-1 <TAB><TAB>
ocf: stonith: systemd:
crm(live)configure# primitive fence-1 stonith:<TAB><TAB>
stonith:apcmaster stonith:fence_compute stonith:fence_ipmilanplus
stonith:apcmastersnmp stonith:fence_docker stonith:fence_ironic
stonith:apcsmart stonith:fence_drac5 stonith:fence_kdump
...
crm(live)configure# primitive fence-1 stonith:fence_ipmilan params <TAB><TAB>
action= ip= passwd= pcmk_host_list=
auth= ipaddr= passwd_script= pcmk_host_map=
...
crm(live)configure# primitive fence-1 stonith:fence_ipmilan params auth=<TAB><TAB>
auth (select): IPMI Lan Auth type.
Allowed values: md5, password, none
crmsh also comes with bash completion you can use directly from the system shell. That should get installed automatically along with the command itself π
β Shorthand syntax β
When you're using the crm shell to manage clusters, you're gonna end up typing a whole lot of commands over and over again. Clear command names like configure genuinely help with understanding and learning the cluster shell β but they're easy to misspell and tedious to type on repeat π The interactive mode and tab completion both help with this, but the crm shell also understands a variety of shorthand aliases for all the commands.
For example: instead of typing crm status, you can type crm st or crm stat. Instead of crm configure you can type crm cfg or even crm cf. crm resource shortens to crm rsc, and so on β¨
The exact list of accepted aliases is too long to print in full, but experimentation and typos should help you discover more of them. Not me encouraging typos but like... it works π
π₯ FEATURES π₯
crmsh's feature set covers a wide range of functionality, and understanding how and when to use the various features of the shell can be difficult ngl. This section of the guide describes some of the features and use cases of crmsh in more depth. The intention is both to give you a deeper understanding of these features and to serve as a guide to using them π«Ά
π Shadow CIB usage π
A Shadow CIB is a normal cluster configuration stored in a file. You can manipulate them in much the same way as the live CIB, with one key difference: changes to a shadow CIB have no effect on the actual cluster resources. An administrator can choose to apply any of them to the cluster, which replaces the running configuration with the one found in the shadow CIB π
The crm prompt always contains the name of the configuration currently in use β or the string live if you're using the live cluster configuration β¨
When editing the configuration in the configure level, no changes are actually applied until the commit command is executed. So you can start editing a configuration as usual, but instead of committing the changes to the active CIB, save them to a shadow CIB π
The following example configure session demonstrates how this can be done:
crm(live)configure# cib new test-2
INFO: test-2 shadow CIB created
crm(test-2)configure# commit
more coming bestie, don't go anywhere π
β±οΈ Timeout formulas β±οΈ
Okay so if you use the crm cluster init command to set up a cluster β especially when you're rolling with SBD as the STONITH device β crmsh literally does the math for you and configures a whole bunch of fencing-related settings based on a set of formulas. Math queen behavior honestly π
SBD related timeouts. The watchdog timeout: default value is 15s. That value comes straight from the definition in /etc/crm/profiles.xml, and it can totally be a different value if you're using a different profile.
The msgwait timeout (this one's only for disk-based SBD):
msgwait = 2 * watchdog
# When setting crashdump watchdog timeout
msgwait = 2 * watchdog + crashdump_watchdog_timeout
SBD_WATCHDOG_TIMEOUT:
# For diskless SBD
SBD_WATCHDOG_TIMEOUT = Default value is 15s. This value is from the definition
in /etc/crm/profiles.xml, can be a different value with a different profile.
# When adding diskless SBD and QDevice together from crm cluster init
if SBD_WATCHDOG_TIMEOUT < 35s:
SBD_WATCHDOG_TIMEOUT = 35s
# When adding diskless SBD in a cluster with QDevice already
if SBD_WATCHDOG_TIMEOUT < qdevice_sync_timeout:
SBD_WATCHDOG_TIMEOUT = qdevice_sync_timeout + 5s
# When adding QDevice in a cluster with diskless SBD already
if SBD_WATCHDOG_TIMEOUT < 35s:
SBD_WATCHDOG_TIMEOUT = 35s
SBD_DELAY_START:
# For disk-based SBD
SBD_DELAY_START = pcmk_delay_max + msgwait + corosync.token + corosync.consensus
# For diskless SBD
SBD_DELAY_START = 2 * SBD_WATCHDOG_TIMEOUT + corosync.token + corosync.consensus
TimeoutSec of the sbd.service systemd unit:
default_value = 1min30s
if SBD_DELAY_START > default_value:
TimeoutSec = 1.2 * SBD_DELAY_START
else:
TimeoutSec = default_value
Pacemaker related timeouts. stonith-watchdog-timeout β again, only for diskless SBD:
stonith-watchdog-timeout = 2 * SBD_WATCHDOG_TIMEOUT
# When setting crashdump watchdog timeout
stonith-watchdog-timeout = max(SBD_WATCHDOG_TIMEOUT + crashdump_watchdog_timeout, 2 * SBD_WATCHDOG_TIMEOUT)
stonith-timeout:
# For disk-based SBD
value_from_sbd = 1.2 * msgwait
stonith-timeout = max(value_from_sbd, 60s) + corosync.token + corosync.consensus
# For diskless SBD
value_from_sbd = 1.2 * max(stonith-watchdog-timeout, 2*SBD_WATCHDOG_TIMEOUT)
stonith-timeout = max(value_from_sbd, 60s) + corosync.token + corosync.consensus
# For general scenarios
stonith-timeout = 60s + corosync.token + corosync.consensus
π Configuration semantic checks π
Resource definitions can get checked against the meta-data that ships with the resource agents. These are the checks running right now:
- are required parameters set
- existence of defined parameters
- timeout values for operations
The parameter checks are kinda obvious and lowkey need no further explanation. If they fail, that's treated as a configuration error, periodt.
The timeouts for operations should be at least as long as the ones recommended in the meta-data. Too-short timeout values are like the #1 most common mistake in cluster configurations, and honestly it gets worse β they slip right through if your cluster testing wasn't thorough π. Operation timeout issues are treated as warnings, but fr fr make sure the timeouts are actually usable in your environment. Also note the values given are just advisory minimums β your resources may straight up require longer timeouts, bestie.
You can tune how often the checks run and how errors get treated with the check-frequency and check-mode preferences. β¨
Heads up: ifcheck-frequencyis set toalwaysandcheck-modetostrict, errors are not tolerated and such configuration cannot be saved. Like, at all. No cap.
π Configuration templates π
Deprecation note π
Configuration templates have been deprecated in favor of the more capable cluster scripts. Wanna learn how to use cluster scripts? Peep the dedicated documentation on the crmsh website at http://crmsh.github.io/, or check out the Script section. (Yes we're sad about it too, but we move.)
Configuration templates are ready-made configurations created by actual cluster experts. They're designed so that users can generate valid cluster configurations with minimum effort. If you're new to Pacemaker, templates might genuinely be the best way to start. π«Ά
We're gonna show you here how to create a simple yet functional Apache configuration:
# crm configure
crm(live)configure# template
crm(live)configure template# list templates
apache filesystem virtual-ip
crm(live)configure template# new web <TAB><TAB>
apache filesystem virtual-ip
crm(live)configure template# new web apache
INFO: pulling in template apache
INFO: pulling in template virtual-ip
crm(live)configure template# list
web2-d web2 vip2 web3 vip web
So we enter the template level from configure. Use the list command to show the templates available on the system. The new command creates a configuration from the apache template. You can use tab completion to pick templates β iconic. Note that the apache template depends on a virtual IP address, which gets automatically pulled along with it. The list command shows the just-created web configuration, among other configurations (I hope that you, unlike me, will use more sensible and descriptive names π).
The show command, which displays the resulting configuration, may be used to get an idea about the minimum required changes that have to be done. All <red>ERROR</red> messages show the line numbers in which the respective parameters are to be defined:
crm(live)configure template# show
ERROR: 23: required parameter ip not set
ERROR: 61: required parameter id not set
ERROR: 65: required parameter configfile not set
crm(live)configure template# edit
The edit command invokes the preferred text editor with the web configuration. At the top of the file, the user is advised how to make changes. A good template should require from the user to specify only parameters. For example, the web configuration we created above has the following required and optional parameters (all parameter lines start with %%):
$ grep -n ^%% ~/.crmconf/web
23:%% ip
31:%% netmask
35:%% lvs_support
61:%% id
65:%% configfile
71:%% options
76:%% envfiles
These lines are the only ones that should be modified. Simply append the parameter value at the end of the line. For instance, after editing this template, the result could look like this (we used tabs instead of spaces to make the values stand out):
$ grep -n ^%% ~/.crmconf/web
23:%% ip 192.168.1.101
31:%% netmask
35:%% lvs_support
61:%% id websvc
65:%% configfile /etc/apache2/httpd.conf
71:%% options
76:%% envfiles
As you can see, the parameter line format is very simple:
%% <name> <value>
After editing the file, use show again to display the configuration:
crm(live)configure template# show
primitive virtual-ip IPaddr \
params ip=192.168.1.101
primitive apache apache \
params configfile="/etc/apache2/httpd.conf"
monitor apache 120s:60s
group websvc \
apache virtual-ip
The target resource of the apache template is a group, which we named websvc in this sample session.
This configuration looks exactly as you could type it at the configure level. The whole point of templates is to save you some typing. It's important, though, to actually understand the configuration being produced. π
Finally, the configuration may be applied to the current crm configuration (note how the configuration changed slightly β though it's still equivalent β after being digested at the configure level):
crm(live)configure template# apply
crm(live)configure template# cd ..
crm(live)configure# show
node xen-b
node xen-c
primitive apache apache \
params configfile="/etc/apache2/httpd.conf" \
op monitor interval=120s timeout=60s
primitive virtual-ip IPaddr \
params ip=192.168.1.101
group websvc apache virtual-ip
Note that this still does not commit the configuration to the CIB which is used in the shell β either the running one (live) or some shadow CIB. For that you still need to execute the commit command. Don't forget the commit, bestie, I'm begging π
To complete our example, we should also define the preferred node to run the service:
crm(live)configure# location websvc-pref websvc 100: xen-b
If you're not happy with some resource names which are provided by default, you can rename them now:
crm(live)configure# rename virtual-ip intranet-ip
crm(live)configure# show
node xen-b
node xen-c
primitive apache apache \
params configfile="/etc/apache2/httpd.conf" \
op monitor interval=120s timeout=60s
primitive intranet-ip IPaddr \
params ip=192.168.1.101
group websvc apache intranet-ip
location websvc-pref websvc 100: xen-b
To summarize, working with templates typically consists of the following steps:
new: create a new configuration from templatesedit: define parameters, at least the required onesshow: see if the configuration is validapply: apply the configuration to theconfigurelevel
π§ͺ Resource testing π§ͺ
The amount of detail in a cluster makes all configurations prone to errors. By far the largest number of issues in a cluster is due to bad resource configuration. The shell can help quickly diagnose such problems. And considerably reduce your keyboard wear. π β¨
Let's say that we entered the following configuration:
node xen-b
node xen-c
node xen-d
primitive fencer stonith:external/libvirt \
params hypervisor_uri="qemu+tcp://10.2.13.1/system" \
hostlist="xen-b xen-c xen-d" \
op monitor interval=2h
primitive svc Xinetd \
params service=systat \
op monitor interval=30s
primitive intranet-ip IPaddr2 \
params ip=10.2.13.100 \
op monitor interval=30s
primitive apache apache \
params configfile="/etc/apache2/httpd.conf" \
op monitor interval=120s timeout=60s
group websvc apache intranet-ip
location websvc-pref websvc 100: xen-b
Before typing commit to submit the configuration to the cib, we can make sure that all resources are usable on all nodes:
crm(live)configure# rsctest websvc svc fencer
β¦okay so before anything: the resources you're testing cannot be running on any node, periodt. If they are, rsctest will straight up refuse to do a single thing. And yeah, if the config you're poking at lives in a CIB shadow, a commit is irrelevant β the whole point is just that nothing's running anywhere. π
note on stopping all resources
So instead of not committing a config, you can also just tell Pacemaker "bestie do not start anything":
crm(live)configure# property stop-all-resources=yes
Almost none β resources of class stonith are still started. But the shell isn't as strict when it comes to stonith resources, so like, whatever.
Order matters, ok? A resource depends on everything to its left. In most configurations it's probably practical to test resources in several runs, based on their dependencies. Plan your little test runs like a playlist. π
And beyond groups, crm does not interpret constraints, so it knows zero about resource dependencies. It also has no idea whether a resource can even run on a node at all in an asymmetric cluster. If a resource isn't meant to run on every node, it's on you to specify the list of eligible nodes. No cap.
π Access Control Lists (ACL) π
note on ACLs in Pacemaker 1.1.12
Support for ACLs got revised in Pacemaker version 1.1.12 and up. Depending on which version you're on, the info in this section may no longer be accurate β go look for the acl_target configuration element for the details on the new syntax. π
By default, users from the haclient group have full access to the cluster (or, more precisely, to the CIB). ACLs let you do finer access control. Fancy.
ACLs consist of an ordered set of access rules. Each rule allows read or write access, or denies access completely. Rules typically get combined to produce a specific role. Then users get assigned a role. It's giving group project, but the group project actually works. β¨
For instance, here's a role defining a set of rules allowing management of a single resource:
role bigdb_admin \
write meta:bigdb:target-role \
write meta:bigdb:is-managed \
write location:bigdb \
read ref:bigdb
The first two rules let you modify the target-role and is-managed meta attributes β which effectively enables users in this role to stop/start and manage/unmanage the resource. The constraints write-access rule lets them move the resource around. And finally, the user gets read access to the resource definition. Slay. π
For proper operation of all Pacemaker programs, it's advisable to add the following role to all users:
role read_all \
read cib
Want finer-grained read access? Try the rules in this role:
role basic_read \
read node attribute:uname \
read node attribute:type \
read property \
read status
It is however possible that some Pacemaker programs (e.g. ptest) may not function correctly if the whole CIB isn't readable. π
Some of the ACL rules in the examples above get expanded by the shell into XPath specifications. For instance, meta:bigdb:target-role expands to:
//primitive[@id='bigdb']/meta_attributes/nvpair[@name='target-role']
You can see the expansion by showing XML:
crm(live) configure# show xml bigdb_admin
...
<acls>
<acl_role id="bigdb_admin">
<write id="bigdb_admin-write"
xpath="//primitive[@id='bigdb']/meta_attributes/nvpair[@name='target-role']"/>
Many different XPath expressions can have equal meaning. For instance, these two are equal β but only the first one is gonna be recognized as a shortcut:
//primitive[@id='bigdb']/meta_attributes/nvpair[@name='target-role']
//resources/primitive[@id='bigdb']/meta_attributes/nvpair[@name='target-role']
XPath is a powerful language and all, but keep your ACL xpaths simple, and use the builtin shortcuts whenever possible. fr fr. πΈ
π¦ Syntax: Resource sets π¦
Using resource sets can be a bit confusing unless you know the details of the implementation in Pacemaker as well as how to interpret the syntax crmsh gives you. So let's break it down.
Three different types of resource sets are provided by crmsh, and each one implies different values for the two resource set attributes, sequential and require-all.
sequentialβ if false, the resources in the set don't depend on each other internally. Settingsequentialto true implies a strict order of dependency within the set.require-allβ if false, only one resource in the set is required to fulfil the requirements of the set. The set of A, B and C withrequire-allset to false is to be read as "A OR B OR C" when its dependencies are resolved.
The three types of resource sets modify the attributes like this:
- Implicit sets (no brackets).
sequential=true,require-all=true - Parenthesis set (
( ... )).sequential=false,require-all=true - Bracket set (
[ ... ]).sequential=false,require-all=false
To create a set with the properties sequential=true and require-all=false, explicitly set sequential in a bracketed set: [ A B C sequential=true ].
To create multiple sets with both sequential and require-all set to true, explicitly set sequential in a parenthesis set: A B ( C D sequential=true ).
π Syntax: Attribute list references π
Attribute lists are used to set attributes and parameters for resources, constraints and property definitions. For example, to set the virtual IP used by an IPAddr2 resource, the attribute ip can be set in an attribute list for that resource.
Attribute lists can have identifiers that name them, and other resources can reuse the same attribute list by referring to that name using an $id-ref. For example, the following statement defines a simple dummy resource with an attribute list which sets the parameter state to the value 1 and sets the identifier for the attribute list to on-state:
primitive dummy-1 Dummy params $id=on-state state=1
To refer to this attribute list from a different resource, refer to the on-state name using an id-ref:
primitive dummy-2 Dummy params $id-ref=on-state
The resource dummy-2 will now also have the parameter state set to the value 1. Reuse era. β»οΈβ¨
π Syntax: Attribute references π
Sometimes referencing whole attribute lists is too coarse-grained β like when two different parameters with different names should have the same value set. Instead of copying the value in multiple places, you can create references to individual attributes in attribute lists.
To name an attribute so you can refer to it later, prefix the attribute name with a $ character (as seen above with the special names $id and $id-ref):
primitive dummy-1 Dummy params $state=1
The identifier state can now be used to refer to this attribute from other primitives, using the @<id> syntax:
primitive dummy-2 Dummy params @state
In some cases, using the attribute name as the identifier doesn't work due to name clashes. In that case, the syntax $<id>:<name>=<value> can be used to give the attribute a different identifier:
primitive dummy-1 params $dummy-state-on:state=1
primitive dummy-2 params @dummy-state-on
iykyk π
β Syntax: Rule expressions β
Many of the configuration commands in crmsh now support rule expressions, which can influence what attributes apply to a resource, or under which conditions a constraint is applied β depending on changing conditions like date, time, the value of attributes and more. Very main character of them.
Here's an example of a simple rule expression used to apply a different resource parameter on the node named node1:
primitive my_resource Special \
params 2: rule #uname eq node1 interface=eth1 \
params 1: interface=eth0
This primitive resource has two lists of parameters with descending priority. The parameter list with the highest priority is applied first, but only if the rule expressions for that parameter list all apply. In this case, the rule #uname eq node1 limits the parameter list so it's only applied on node1. π―
Note that rule expressions are not terminated β they're immediately followed by the data to which the rule is applied. In this case, the name-value pair interface=eth1.
Rule expressions can contain multiple expressions connected using the boolean operator or and and. Full syntax for rule expressions, listed below:
rules ::
rule [id_spec] [$role=<role>] <score>: <expression>
[rule [id_spec] [$role=<role>] <score>: <expression> ...]
id_spec :: $id=<id> | $id-ref=<id>
score :: <number> | <attribute> | [-]inf
expression :: <simple_exp> [<bool_op> <simple_exp> ...]
bool_op :: or | and
simple_exp :: <attribute> [type:]<binary_op> <value>
| <unary_op> <attribute>
| date <date_expr>
type :: <string> | <version> | <number>
binary_op :: lt | gt | lte | gte | eq | ne
unary_op :: defined | not_defined
date_expr :: lt <end>
| gt <start>
| in start=<start> end=<end>
| in start=<start> <duration>
| spec <date_spec>
duration|date_spec ::
hours=<value>
| monthdays=<value>
| weekdays=<value>
| yearsdays=<value>
| months=<value>
| weeks=<value>
| years=<value>
| weekyears=<value>
Note: pacemaker has deprecated support for multiple top-level rules within a location constraint since version 2.1.8. π
β³ LIFETIME PARAMETER FORMAT β³
Lifetimes can be specified in the ISO 8601 time format or the ISO 8601 duration format. To distinguish between months and minutes, use the PT prefix before specifying minutes. The duration format is one of PnYnMnDTnHnMnS, PnW, P<date>T<time>.
P = duration. Y = year. M = month. W = week. D = day. T = time. H = hour. M = minute. S = second.
Examples:
PT5M = 5 minutes later.
3D = 3 days later.
PT1H = 1 hour later.
The cluster checks lifetimes at an interval defined by the cluster-recheck-interval property (default 15 minutes). Yes, minutes and months both use M β that's why the PT prefix exists, bestie, it's not a vibe, it's a necessity. ππ«Ά
π COMMAND REFERENCE π
The commands are structured to be compatible with the shell command line. Sometimes the underlying Pacemaker grammar uses characters that have special meaning in bash, and those will need to be quoted. This includes the hash or pound sign (#), single and double quotes, and any significant whitespace.
Whitespace is also significant when assigning values, meaning that key=value is different from key = value. Do not come for me about the spaces. π§
Lowkey the best glow-up in this whole tool is that you don't have to type the whole command name. Commands can be referenced using short-hand as long as the short-hand is unique β it can be either a prefix of the command name, or a prefix string of characters found in the name. π
So like, status can be abbreviated as st or su, and configure as conf or cfg. Cute, right? π
The syntax for the commands is given below in an informal, BNF-like grammar. (Yes bestie we're doing grammar, stay with me, it's like three lines.)
<value>denotes a string.[value]means that the construct is optional.- The ellipsis (
...) signifies that the previous construct may be repeated. first|secondmeans eitherfirstorsecond.- The rest are literals (strings,
:,=).
status π
Show cluster status. The status is displayed by crm_mon. Supply additional arguments for more information or a different format. See crm_mon(8) for more details.
Example:
status
status simple
status full
Usage:
status [<option> ...]
option :: full
| bynode
| inactive
| ops
| timing
| failcounts
| verbose
| quiet
| html
| xml
| simple
| tickets
| noheaders
| detail
| brief
verify β
Performs basic checks for the cluster configuration and current status, reporting potential issues. It's giving "wellness check for your cluster" energy, honestly. π©Ί
See crm_verify(8) and crm_simulate(8) for more details.
Example:
verify
verify scores
Usage:
verify [scores]
cluster β Cluster setup and management ποΈ
Whole-cluster configuration management with High Availability awareness. Iconic. π
The commands on the cluster level allow configuration and modification of the underlying cluster infrastructure, and also supply tools to do whole-cluster systems management.
These commands enable easy installation and maintenance of a HA cluster, by providing support for package installation, configuration of the cluster messaging layer, file system setup and more. Basically the whole "make it exist and keep it alive" arc. β¨
copy π
Copy file to other cluster nodes.
Copies the given file to all other nodes unless given a list of nodes to copy to as argument.
Usage:
copy <filename> [nodes ...]
Example:
copy /etc/motd
diff π
Displays the difference, if any, between a given file on different nodes. If the second argument is --checksum, a checksum of the file will be calculated and displayed for each node.
Usage:
diff <file> [--checksum] [nodes...]
Example:
diff /etc/crm/crm.conf node2
diff /etc/resolv.conf --checksum
disable π«
Usage:
disable [--all | <node>... ]
Specify node(s) on which to disable cluster service. If no nodes are specified, disable cluster service on the local node. If --all is specified, disable cluster service on all nodes.
Options:
-h,--helpβ show this help message--allβ to disable cluster service on all nodes
enable π’
Usage:
enable [--all | <node>... ]
Specify node(s) on which to enable cluster service. If no nodes are specified, enable cluster service on the local node. If --all is specified, enable cluster service on all nodes.
Options:
-h,--helpβ show this help message--allβ to enable cluster service on all nodes
geo-init π
Usage:
geo-init [options]
Create a new geo cluster with the current cluster as the first member. Pass the complete geo cluster topology as arguments to this command, and then use geo-join and geo-init-arbitrator to add the remaining members to the geo cluster. It's a whole friend group, you're just forming it. π«Ά
Options:
-h,--helpβ show this help message-q,--quietβ be quiet (don't describe what's happening, just do it)-y,--yesβ answer "yes" to all prompts (use with caution)-a,--arbitrator [USER@]HOSTβ geo cluster arbitrator-s,--clusters DESCβ geo cluster description (see details below)-t,--tickets LISTβ tickets to create (space-separated)
And here's the extra detail block that comes with it, verbatim:
-s, --clusters DESC Geo cluster description (see details below)
-t, --tickets LIST Tickets to create (space-separated)
Cluster Description
This is a map of cluster names to IP addresses.
Each IP address will be configured as a virtual IP
representing that cluster in the geo cluster
configuration.
Example with two clusters named paris and amsterdam:
--clusters "paris=192.168.10.10 amsterdam=192.168.10.11"
Name clusters using the --name parameter to
crm bootstrap init.
geo-init-arbitrator βοΈ
Usage:
geo-init-arbitrator [options]
Configure the current node as a geo arbitrator. The command requires an existing geo cluster or geo arbitrator from which to get the geo cluster configuration.
Options:
-h,--helpβ show this help message-q,--quietβ be quiet (don't describe what's happening, just do it)-y,--yesβ answer "yes" to all prompts (use with caution)-c,--cluster-node [USER@]HOSTβ an already-configured geo cluster--use-ssh-agent,--no-use-ssh-agentβ try to use an existing key from ssh-agent (default)
geo-join π€
Usage:
geo-join [options]
This command should be run from one of the nodes in a cluster which is currently not a member of a geo cluster. The geo cluster configuration will be fetched from the provided node, and the cluster will be added to the geo cluster.
Note that each cluster in a geo cluster needs to have a unique name set. The cluster name can be set using the--nameargument toinit, or by configuring corosync with the cluster name in an existing cluster. π
Options:
-h,--helpβ show this help message-q,--quietβ be quiet (don't describe what's happening, just do it)-y,--yesβ answer "yes" to all prompts (use with caution)-c,--cluster-node [USER@]HOSTβ an already-configured geo cluster or arbitrator-s,--clusters DESCβ geo cluster description (seegeo-initfor details)--use-ssh-agent,--no-use-ssh-agentβ try to use an existing key from ssh-agent (default)
health π
Usage 1: General Health Check
Runs a larger set of tests and queries on all nodes in the cluster to verify the general system health and detect potential problems. The full-body checkup moment. π©Ίβ¨
health
Usage 2: Topic-Specified Health Check
Verifies the health of a specified topic.
health hawk2|sles16 [--local] [--fix]
hawk2β check or fix key-based ssh authentication for userhacluster, which is needed byhawk2.--fixβ attempts to automatically resolve any detected issues, eg. hacluster passwordless
sles16β check whether the cluster is good to migrate to SLES 16.--localβ run checks in local mode--fixβ attempts to automatically resolve any detected issues.
init π
Usage:
init [options] [STAGE]
Initialize a cluster from scratch. This command configures a complete cluster, and can also add additional cluster nodes to the initial one-node cluster using the --nodes option. Main character energy: you start alone, then the whole squad shows up. π
Options:
-h,--helpβ show this help message-q,--quietβ be quiet (don't describe what's happening, just do it)-y,--yesβ answer "yes" to all prompts (use with caution, this is destructive, especially those storage related configurations and stages.)-n,--name NAMEβ set the name of the configured cluster.-N,--node [USER@]HOSTβ the member node of the cluster. Note: the current node is always get initialized during bootstrap in the beginning.-S,--enable-sbdβ enable SBD even if no SBD device is configured (diskless mode)-w,--watchdog WATCHDOGβ use the given watchdog device or driver name (only valid together with-sor-Soption)-x,--skip-csync2-syncβ skip csync2 initialization (an experimental option)--use-ssh-agent,--no-use-ssh-agentβ try to use an existing key from ssh-agent (default)
Network configuration:
Options for configuring the network and messaging layer. This is where the cluster actually learns to talk. π£οΈ
-i,--interface IFβ bind to IP address on interfaceIF. Allowed value is nic name or IP address. If a nic name is provided, the first IP of that nic will be used. Use multiple-ifor more links. Note: Only one link is allowed for the non knet transport type-t,--transport TRANSPORTβ the transport mechanism. Allowed value isknet(kronosnet)/udpu(unicast)/udp(multicast). Default isknet-A,--admin-ip IPβ configure IP address as an administration virtual IP-I,--ipv6β configure corosync use IPv6
QDevice configuration:
QDevice participates in quorum decisions. With the assistance of a third-party arbitrator Qnetd, it provides votes so that a cluster is able to sustain more node failures than standard quorum rules allow. It is recommended for clusters with an even number of nodes and highly recommended for 2 node clusters. Literally the designated tie-breaker friend. βοΈ
Options for configuring QDevice and QNetd.
--qnetd-hostname [USER@]HOSTβ user and host of the QNetd server. The host can be specified in either hostname or IP address.--qdevice-port PORTβ TCPPORTof QNetd server (default:5403)--qdevice-algo ALGORITHMβ QNetd decisionALGORITHM(ffsplit/lms, default:ffsplit)--qdevice-tie-breaker TIE_BREAKERβ QNetdTIE_BREAKER(lowest/highest/valid_node_id, default:lowest)--qdevice-tls TLSβ whether using TLS on QDevice (on/off/required, default:on)--qdevice-heuristics COMMANDβCOMMANDto run with absolute path. For multiple commands, use";"to separate (details about heuristics can seeman 8 corosync-qdevice)--qdevice-heuristics-mode MODEβMODEof operation of heuristics (on/sync/off, default:sync)
Storage configuration:
Options for configuring shared storage. π
-s,--sbd-deviceDEVICE β the block device you want for SBD fencing π need multiple paths? Use;as a separator, or just hit-smore than once for multi path (up to 3 devices, that's the cap bestie)-o,--ocfs2-deviceDEVICE β the block device for OCFS2 π¦ when you're using Cluster LVM2 to manage the shared storage, you can hand it one or a whole bunch of raw disks β use;as a separator or-omultiple times for multi path (must also pass the-Coption). NOTE: this is a Technical Preview π-g,--gfs2-deviceDEVICE β the block device for GFS2 πΈ when Cluster LVM2 is managing the shared storage, you can specify one or multiple raw disks,;as a separator or-gmultiple times for multi path (must specify the-Coption too). NOTE: this is a Technical Preview π-C,--cluster-lvm2β use Cluster LVM2 (only valid together with the-oor-goption, fr fr). NOTE: this is a Technical Preview π«Ά-m,--mount-pointMOUNT β the mount point for your OCFS2 or GFS2 device (default is/srv/clusterfs, only valid together with-oor-g). NOTE: this is a Technical Preview β¨
Stage can be one of: π
sshβ Create SSH keys for passwordless SSH between cluster nodesfirewalldβ Add high-availability service to firewalldcsync2β Configure csync2corosyncβ Configure corosyncsbdβ Configure SBD (requires-s <dev>)clusterβ Bring the cluster onlineocfs2β Configure OCFS2 (requires-o <dev>) NOTE: this is a Technical Previewgfs2β Configure GFS2 (requires-g <dev>) NOTE: this is a Technical Previewadminβ Create administration virtual IP (optional)qdeviceβ Configure qdevice and qnetd
Note: π
- If stage is not specified, the script will run through each stage in sequence, with prompts for required information. So like, it walks you through the whole thing, no skipping π
Examples: π
# Setup the cluster on the current node
crm cluster init -y
# Setup the cluster with multiple nodes
(NOTE: the current node will be part of the cluster even not listed in the -N option as below)
crm cluster init -N node1 -N node2 -N node3 -y
# Setup the cluster on the current node, with two network interfaces
crm cluster init -i eth1 -i eth2 -y
# Setup the cluster on the current node, with disk-based SBD
crm cluster init -s <share disk> -y
# Setup the cluster on the current node, with diskless SBD
crm cluster init -S -y
# Setup the cluster on the current node, with QDevice
crm cluster init --qnetd-hostname <qnetd addr> -y
# Setup the cluster on the current node, with SBD+OCFS2
crm cluster init -s <share disk1> -o <share disk2> -y
# Setup the cluster on the current node, with SBD+GFS2
crm cluster init -s <share disk1> -g <share disk2> -y
# Setup the cluster on the current node, with SBD+OCFS2+Cluster LVM
crm cluster init -s <share disk1> -o <share disk2> -o <share disk3> -C -y
# Setup the cluster on the current node, with SBD+GFS2+Cluster LVM
crm cluster init -s <share disk1> -g <share disk2> -g <share disk3> -C -y
# Add SBD on a running cluster
crm cluster init sbd -s <share disk> -y
# Replace SBD device on a running cluster which already configured SBD
crm -F cluster init sbd -s <share disk> -y
# Add diskless SBD on a running cluster
crm cluster init sbd -S -y
# Add QDevice on a running cluster
crm cluster init qdevice --qnetd-hostname <qnetd addr> -y
# Add OCFS2+Cluster LVM on a running cluster
crm cluster init ocfs2 -o <share disk1> -o <share disk2> -C -y
# Add GFS2+Cluster LVM on a running cluster
crm cluster init gfs2 -g <share disk1> -g <share disk2> -C -y
π join
Usage:
join [options] [STAGE]
Join the current node to an existing cluster π«Ά ok so the current node literally cannot already be a member of a cluster β that's the vibe check it has to pass. Then you pass any node in the existing cluster as the argument to the -c option. Easy.
Options:
-h,--helpβ Show this help message-q,--quietβ Be quiet (don't describe what's happening, just do it) π€«-y,--yesβ Answer "yes" to all prompts (use with caution) β οΈ--use-ssh-agent,--no-use-ssh-agentβ Try to use an existing key from ssh-agent (default)
Network configuration:
Options for configuring the network and messaging layer.
-c,--cluster-node[USER@]HOST β User and host to login to an existing cluster node. The host can be specified with either a hostname or an IP π₯-i,--interfaceIF β Bind to IP address on interface IF. Allowed value is nic name or IP address. If a nic name is provided, the first IP of that nic will be used. Use multiple-ifor more links. Note: Only one link is allowed for the non knet transport type π
π remove
Usage:
remove [options] [<node> ...]
Remove one or more nodes from the cluster. Bye bestie π
Heads up: this command can remove the last node in the cluster, which effectively removes the whole entire cluster. To remove the last node, pass the --force argument to crm. Like, the whole cluster. Gone. π
Options:
-h,--helpβ Show this help message-q,--quietβ Be quiet (don't describe what's happening, just do it)-y,--yesβ Answer "yes" to all prompts (use with caution)-c,--cluster-nodeHOST β IP address or hostname of cluster node which will be deleted-F,--forceβ Remove current node--qdeviceβ Remove QDevice configuration and service from cluster
π₯ crash_test
Usage:
crash_test [--kill-sbd | --kill-corosync | --kill-pacemakerd | --fence-node NODE | --split-brain-iptables] [-l] [-f] [-h]
Cluster crash test tool set π§ this one standardizes the steps to simulate cluster failures before you move your cluster into production β so you find out now instead of at 3am, yk? It's carefully designed with the proper steps and does not change any configuration to harm the cluster without the confirmation from users. No sneaky sabotage, no cap.
Options:
--kill-sbdβ Kill sbd daemon--kill-corosyncβ Kill corosync daemon--kill-pacemakerdβ Kill pacemakerd daemon--fence-nodeNODE β Fence specific node--split-brain-iptablesβ Make split brain by blocking traffic between cluster nodes-l,--kill-loopβ Kill process in loop
other options:
-f,--forceβ Force to skip all prompts (Use with caution, the intended fault will be injected to verify the cluster resilence) β οΈ-h,--helpβ Show this help message and exit
Where stuff lands: π
- Log:
/var/log/crmsh/crmsh.log - Json results:
/var/lib/crmsh/crash_test/crash_test.json - For each
--kill-*testcase, report directory:/var/lib/crmsh/crash_test
π¦ restart
Usage:
stop [--all | <node>... ]
Specify node(s) on which to stop cluster service. If no nodes are specified, stop cluster service on the local node. If --all is specified, stop cluster service on all nodes. (Yes bestie, the usage line says stop β that's literally what's written in the page, we don't edit the source π
)
Options:
-h,--helpβ Show this help message--allβ To stop cluster service on all nodes
β rename
Rename the cluster name π
Usage:
rename <new_cluster_name>
πΈ run
This command takes a shell statement as argument, executes that statement on all nodes in the cluster or a specific node, and reports the result. It's giving "group chat but for commands" β¨
Usage:
run <command> [node ...]
Example:
run "cat /proc/uptime"
run "ls" node1 node2
π start
Usage:
start [--all | <node>... ]
Specify node(s) on which to start cluster service. If no nodes are specified, start cluster service on the local node. If --all is specified, start cluster service on all nodes. Slay.
Options:
-h,--helpβ Show this help message--allβ To start cluster service on all nodes
π status
Reports the status for the cluster messaging layer on the local node. Just the local node, okay? Don't @ me.
Usage:
status
π§ stop
Usage:
stop [--all | <node>... ]
Specify node(s) on which to stop cluster service. If no nodes are specified, stop cluster service on the local node. If --all is specified, stop cluster service on all nodes.
Options:
-h,--helpβ Show this help message--allβ To stop cluster service on all nodes
π wait_for_startup
Mostly useful in scripts or automated workflows, this command will attempt to connect to the local cluster node repeatedly π the command will keep trying until the cluster node responds, or the timeout elapses. The timeout can be changed by supplying a value in seconds as an argument.
Usage:
wait_for_startup
π script β Cluster script management
A big part of the configuration and management of a cluster is collecting information about all cluster nodes and deploying changes to those nodes. And like, often just performing the same procedure on all nodes will encounter problems, due to subtle differences in the configuration π
For example, when configuring a cluster for the first time, the software needs to be installed and configured on all nodes before the cluster software can be launched and configured using crmsh. This process is cumbersome and error-prone, and the goal is for scripts to make this process easier. Which, honestly, ate.
Scripts are implemented using the python parallax package which provides a thin wrapper on top of SSH. This allows the scripts to function through the usual SSH channels used for system maintenance, requiring no additional software to be installed or maintained. Obsessed, genuinely πΈ
json
This command provides a JSON API for the cluster scripts, intended for use in user interface tools that want to interact with the cluster via scripts.
The command takes a single argument, which should be a JSON array with the first member identifying the command to perform.
The output is line-based: Commands that return multiple results will return them line-by-line, ending with a terminator value: "end".
When providing parameter values to this command, they should be provided as nested objects, so virtual-ip:ip=192.168.0.5 on the command line becomes the JSON object {"virtual-ip":{"ip":"192.168.0.5"}} π«Ά
API:
okay so the output-shape cheat sheet for these script commands is exactly this, bestie β itβs giving very structured, very demure:
["list"]
=> [{name, shortdesc, category}]
["show", <name>]
=> [{name, shortdesc, longdesc, category, <<steps>>}]
<<steps>> := [{name, shortdesc], longdesc, required, parameters, steps}]
<<params>> := [{name, shortdesc, longdesc, required, unique, advanced,
type, value, example}]
["verify", <name>, <<values>>]
=> [{shortdesc, longdesc, text, nodes}]
["run", <name>, <<values>>]
=> [{shortdesc, rc, output|error}]
π list
Lists the available scripts, sorted by category. Scripts that have the special Script category are hidden by default, since theyβre mainly used by other scripts or commands. To also show these, pass all as argument.
To get a flat list of script names, not sorted by category, pass names as an extra argument.
Usage:
list [all] [names]
Example:
list
list all names
π run
Given a list of parameter values, this command will execute the actions specified by the cluster script. The format for the parameter values is the same as for the verify command.
Can optionally take at least two parameters:
nodes=<nodes>: List of nodes that the script runs overdry_run=yes|no: If set, the script will not perform any modifications.
Additional parameters may be available depending on the script.
Use the show command to see what parameters are available.
Usage:
run <script> [args...]
Example:
run apache install=true
run sbd id=sbd-1 node=node1 sbd_device=/dev/disk/by-uuid/F00D-CAFE
π show
Prints a description and short summary of the script, with descriptions of the accepted parameters.
Advanced parameters are hidden by default. To show the complete list of parameters accepted by the script, pass all as argument.
Usage:
show <script> [all]
Example:
show virtual-ip
β verify
Checks the given parameter values, and returns a list of actions that will be executed when running the script if provided the same list of parameter values.
Usage:
verify <script> [args...]
Example:
verify sbd id=sbd-1 node=node1 sbd_device=/dev/disk/by-uuid/F00D-CAFE
π₯ corosync - Corosync management
Corosync is the underlying messaging layer for most HA clusters. This level provides commands for editing and managing the corosync configuration.
π§Ύ diff
Diffs the corosync configurations on different nodes. If no nodes are given as arguments, the corosync configurations on all nodes in the cluster are compared.
diff takes an option argument --checksum, to display a checksum for each file instead of calculating a diff.
Usage:
diff [--checksum] [node...]
βοΈ edit
Opens the Corosync configuration file in an editor.
Usage:
edit
π get
Returns the value configured in corosync.conf, which is not necessarily the value used in the running configuration. See reload for telling corosync about configuration changes.
The argument is the complete dot-separated path to the value.
If there are multiple values configured with the same path, the command returns all values for that path. For example, to get all configured ring0_addr values, use this command:
Example:
get nodelist.node.ring0_addr
π log
Opens the log file specified in the corosync configuration file. If no log file is configured, this command returns an error.
The pager used can be configured either using the PAGER environment variable or in crm.conf.
Usage:
log
π₯ pull
Gets the corosync configuration from another node and copies it to this node.
Usage:
pull <node>
π€ push
Pushes the corosync configuration file on this node to the list of nodes provided. If no target nodes are given, the configuration is pushed to all other nodes in the cluster.
It is recommended to use csync2 to distribute the cluster configuration files rather than relying on this command.
Usage:
push [node] ...
Example:
push node-2 node-3
π reload
Tells all instances of corosync in this cluster to reload corosync.conf.
After pushing a new configuration to all cluster nodes, call this command to make corosync use the new configuration.
Usage:
reload
π οΈ set
Sets the value identified by the given path. If the value does not exist in the configuration file, it will be added. However, if the section containing the value does not exist, the command will fail.
If there are multiple entries with the same path, you can specify index set <path> <value> <index> to set a specific entry. The default index is 0.
Usage:
set quorum.expected_votes 2
set nodelist.node.nodeid 3 1
π«Ά show
Displays the corosync configuration on the current node.
show
π status
Default is ring.
Usage:
status [ring|quorum|qdevice|qnetd|cpg]
π link
Knet is a multi-link and multi-protocol transport used by corosync.
Upon successfully changing the configuration file locally, it will be synced to all cluster nodes.
Usage:
link add <nodename>=<new_address> ... [options <option>=[value] ...]
link remove <linknumber>
link show
link update <linknumber> [<nodename>=<new_address> ... ] [options <option>=[value] ...]
show β Lists knet links defined in the configuration file.
Usage:
show
add β Adds a knet link to the configuration file.
Usage:
add <nodename>=<ip_address> ... [options <name>=value ...]
All nodes in the cluster must be specified in <nodename>=<ip_address>. options are optional. Unspecified options will be omitted from the configuration file.
Available options:
mcastportknet_link_priorityknet_ping_intervalknet_ping_timeoutknet_ping_precisionknet_pong_countknet_transport
See corosync.conf(5) for details about these options.
update β Modifies an existing knet link in the configuration file, changing node addresses and/or link options.
Usage:
update <linknumber> [<nodename>=<ip_address> ...] [options <name>=[value] ...]
Unspecified nodes will keep their IP addresses unchanged.
Unspecified options will be kept untouched.
Specify <name>= to remove the option from the configuration file.
Available options:
mcastportknet_link_priorityknet_ping_intervalknet_ping_timeoutknet_ping_precisionknet_pong_countknet_transport
See corosync.conf(5) for details about these options.
remove β Removes an existing knet link from the configuration file.
The last remaining link in the cluster cannot be removed.
Usage:
remove <linknumber>
π cib - CIB shadow management
This level is for management of shadow CIBs. It is available both at the top level and the configure level.
All the commands are implemented using cib_shadow(8) and the CIB_shadow environment variable. The user prompt always includes the name of the currently active shadow or the live CIB.
πΈ cibstatus
Enter edit and manage the CIB status section level. See the CIB status management section.
πΎ commit
Apply a shadow CIB to the cluster. If the shadow name is omitted then the current shadow CIB is applied.
Temporary shadow CIBs are removed automatically on commit.
Usage:
commit [<cib>]
ποΈ delete
Delete an existing shadow CIB.
Usage:
delete <cib>
π§Ύ diff
Print differences between the current cluster configuration and the active shadow CIB.
Usage:
diff
π¦ import
At times it may be useful to create a shadow file from the existing CIB. The CIB may be specified as file or as a PE input file number. The shell will look up files in the local directory first and then in the PE directory (typically /var/lib/pengine). Once the CIB file is found, it is copied to a shadow and this shadow is immediately available for use at both configure and cibstatus levels.
If the shadow name is omitted then the target shadow is named after the input CIB file.
Note that there are often more than one PE input file, so you may need to specify the full name.
Usage:
import {<file>|<number>} [<shadow>]
Examples:
import pe-warn-2222
import 2289 issue2
π list
List existing shadow CIBs.
Usage:
list
β¨ new
Create a new shadow CIB. The live cluster configuration and status is copied to the shadow CIB.
If the name of the shadow is omitted, we create a temporary CIB shadow. It is useful if multiple level sessions are desired without affecting the cluster. A temporary CIB shadow is short lived and will be removed either on commit or on program exit. Note that if the temporary shadow is not committed all changes in the temporary shadow are lost.
Specify withstatus if you want to edit the status section of the shadow CIB (see the cibstatus section). Add force to force overwriting the existing shadow CIB.
To start with an empty configuration that is not copied from the live CIB, specify the empty keyword. (This also allows a shadow CIB to be created in case no cluster is running.)
Usage:
new [<cib>] [withstatus] [force] [empty]
β»οΈ reset
Copy the current cluster configuration into the shadow CIB.
Usage:
reset <cib>
π― use
Choose a CIB source. If you want to edit the status from the shadow CIB specify withstatus (see cibstatus). Leave out the CIB name to switch to the running CIB.
Usage:
use [<cib>] [withstatus]
π¦ ra - Resource Agents (RA) lists and documentation
This level contains commands which show various information about the installed resource agents. It is available both at the top level and at the configure level.
π§© classes
Print all resource agents' classes and, where appropriate, a list of available providers.
Usage:
classes
π info (meta) π
Okay so info is literally the meta-data plug, bestie: it shows the meta-data of a resource agent type, aka the exact spot where users find out how to actually use a resource agent. You can also use the pacemaker-fenced type to get the corresponding meta-data information β iconic.
Usage:
info [<class>:[<provider>:]]<type>
info <type> <class> [<provider>] (obsolete)
Example:
info apache
info ocf:pacemaker:Dummy
info stonith:ipmilan
info pacemaker-fenced
That second form is marked obsolete, just so you know π
π¦ list π¦
This lists the available resource agents for the class you hand it. If the class is ocf, slide a provider in there to get agents that are available only from that provider. Slay.
Usage:
list <class> [<provider>]
Example:
list ocf pacemaker
πΈ providers πΈ
Lists providers for a resource agent type. The class parameter defaults to ocf β lowkey convenient.
Usage:
providers <type> [<class>]
Example:
providers apache
β¨ validate β¨
If the resource agent supports the validate-all action, this calls that action with the parameters you give it, and prints any warnings or errors reported by the agent. Vibe check for your RA, basically.
Usage:
validate <agent> [<key>=<value> ...]
π resource - Resource management π
Welcome to the resource-management level, where resources may be managed. All (or almost all) commands here are implemented with the CRM tools such as crm_resource(8). Main character energy fr fr.
π₯ ban π₯
Bans a resource from running on a certain node. If no node is given as an argument, the resource is banned from the current location.
See move for details on other arguments.
Usage:
ban <rsc> [<node>] [<lifetime>] [force]
π§ cleanup π§
If the resource has any past failures, this clears its history and fail count. Typically done after the resource has temporarily failed.
If a node is omitted, cleanup happens on all nodes.
(Pacemaker 1.1.14) Pass force to clean up the resource itself; otherwise the cleanup command will apply to the parent resource (if any). Important little detail, ngl.
Usage:
cleanup [<rsc>] [<node>] [force]
π clear (unmove, unmigrate, unban) π
Removes any relocation constraint created by the move, migrate or ban command. Cleanup era.
Usage:
clear <rsc>
unmigrate <rsc>
unban <rsc>
π constraints π
Displays the location and colocation constraints affecting the resource. Constraint lore unlocked.
Usage:
constraints <rsc>
π¦ demote π¦
Demotes a promotable resource using the target-role attribute.
Usage:
demote <rsc>
π failcount π
Show/edit/delete the failcount of a resource. When you set a non-zero value and multiple operation failcount entries exist, you should provide operation and interval. interval is a value in seconds.
Usage:
failcount <rsc> set <node> <value> [operation] [interval]
failcount <rsc> delete <node>
failcount <rsc> show <node>
Example:
failcount fs_0 set node1 0 monitor 10
failcount fs_0 delete node1
failcount fs_0 show node1
π locate π
Shows the current location of one or more resources. Where u at, resource?
Usage:
locate [<rsc> ...]
π«Ά maintenance π«Ά
Enables or disables the per-resource maintenance mode. When this mode is enabled, no monitor operations will be triggered for the resource. The maintenance attribute conflicts with is-managed. When setting the maintenance attribute, you get offered the chance to remove the is-managed attribute if it exists.
Usage:
maintenance <resource> [on|off|true|false]
Example:
maintenance rsc1
maintenance rsc2 off
π manage π
Manages a resource using the is-managed attribute. If there are multiple meta attribute sets, the attribute is set in all of them. If the resource is a clone, all is-managed attributes are removed from the children resources. The is-managed attribute conflicts with maintenance. When setting the is-managed attribute, you get offered the chance to remove the maintenance attribute if it exists.
For details on group management see options manage-children.
Usage:
manage <rsc>
β meta β
Show/edit/delete a meta attribute of a resource. Currently, all meta attributes of a resource may be managed with other commands such as resource stop.
Usage:
meta <rsc> set <attr> <value>
meta <rsc> delete <attr>
meta <rsc> show <attr>
Example:
meta ip_0 set target-role stopped
π§ move (migrate) π§
Moves a resource away from its current location.
If the destination node is left out, the resource is migrated by creating a constraint which prevents it from running on the current node. For this type of constraint to be created, the force argument is required.
A lifetime may be given for the constraint. Once it expires, the location constraint will no longer be active.
Usage:
move <rsc> [<node>] [<lifetime>] [force]
πΈ operations πΈ
Shows active operations, optionally filtered by resource and node.
Usage:
operations [<rsc>] [<node>]
π param π
Show/edit/delete a parameter of a resource.
Usage:
param <rsc> set <param> <value>
param <rsc> delete <param>
param <rsc> show <param>
Example:
param ip_0 show ip
π promote π
Promotes a promotable resource using the target-role attribute.
Usage:
promote <rsc>
π₯ refresh π₯
Deletes the resource's history (including failures) so its current state is rechecked.
Usage:
refresh [<rsc>] [<node>] [force]
π restart π
Restarts one or more resources. This is essentially a shortcut for resource stop followed by a start. The shell first waits for the stop to finish β that is, for all resources to really stop β and only then orders the start action. Because this command entails a whole set of operations, informational messages are printed so you can see some progress.
For details on group management see options manage-children.
Usage:
restart <rsc> [<rsc> ...]
Example:
# crm resource restart g_webserver
INFO: ordering g_webserver to stop
waiting for stop to finish .... done
INFO: ordering g_webserver to start
#
π¦ scores π¦
Displays the allocation scores for all resources. Scoreboard moment.
Usage:
scores
π secret π
Sensitive parameters can be kept in local files rather than the CIB in order to prevent accidental data exposure. Use the secret command to manage such parameters. stash and unstash move the value from the CIB and back to the CIB, respectively. The set subcommand sets the parameter to the provided value. delete removes the parameter completely. show displays the value of the parameter from the local file. Use check to verify if the local file content is valid.
Usage:
secret <rsc> set <param> <value>
secret <rsc> stash <param>
secret <rsc> unstash <param>
secret <rsc> delete <param>
secret <rsc> show <param>
secret <rsc> check <param>
Example:
secret fence_1 show password
secret fence_1 stash password
secret fence_1 set password secret_value
β¨ start β¨
Starts one or more resources by setting the target-role attribute. If there are multiple meta attribute sets, the attribute is set in all of them. If the resource is a clone, all target-role attributes are removed from the children resources.
For details on group management see options manage-children.
Usage:
start <rsc> [<rsc> ...]
π«Ά status (show, list) π«Ά
Prints resource status. More than one resource can be shown at once. If the resource parameter is left out, the status of all resources is printed.
Usage:
status [<rsc> ...]
π stop π
Stops one or more resources using the target-role attribute. If there are multiple meta attribute sets, the attribute is set in all of them. If the resource is a clone, all target-role attributes are removed from the children resources.
For details on group management see options manage-children.
Usage:
stop <rsc> [<rsc> ...]
π§ trace π§
Starts tracing RA for the given operation. When [<log-dir>] is not specified, the trace files are stored in <heartbeat_dir>/trace_ra. If the <heartbeat_dir> option in /etc/crm/crm.conf is not defined, it defaults to /var/lib/heartbeat. If the operation to be traced is monitor, note that the number of trace files can grow very quickly. Like, very quickly. Be aware.
If no operation name is given, crmsh will attempt to trace all operations for the RA. This includes any configured operations, start and stop as well as promote/demote for multistate resources.
To trace the probe operation which exists for all resources, either set a trace for monitor with interval 0, or use probe as the operation name.
Note: RA tracing is only supported by OCF resource agents; the pacemaker-execd daemon does not log recurring monitor operations unless an error occurred. Important caveat, bestie.
Usage:
trace <rsc> [<op> [<interval>] [<log-dir>]]
Example:
trace fs start
trace webserver
trace webserver probe
trace fs monitor 0 /var/log/foo/bar
π unmanage π
Unmanages a resource using the is-managed attribute. If there are multiple meta attribute sets, the attribute is set in all of them. If the resource is a clone, all is-managed attributes are removed from the children resources.
For details on group management see options manage-children.
Usage:
unmanage <rsc>
π untrace π
Stops tracing RA for the given operation. If no operation name is given, crmsh will attempt to stop tracing all operations in the resource.
Usage:
untrace <rsc> [<op> [<interval>] ]
Example:
untrace fs start
untrace webserver
π utilization π
Show/edit/delete a utilization attribute of a resource. These attributes describe hardware requirements. By setting the placement-strategy cluster property appropriately, it is possible then to distribute resources based on resource requirements and node size. See also node utilization attributes.
Usage:
utilization <rsc> set <attr> <value>
utilization <rsc> delete <attr>
utilization <rsc> show <attr>
Example:
utilization xen1 set memory 4096
π sbd β SBD management
Okay bestie, this level is the whole SBD situation: it shows you the real-time SBD status plus the static SBD configuration. On top of that it manages the config file for both the disk-based and the diskless SBD scenarios, and it also handles the on-disk metadata for the disk-based scenario. Heads up tho β right now, SBD management requires a running cluster π.
When you run it with the crm -F or --force option, the sbd subcommand will leverage maintenance mode for any changes that require restarting sbd.service.
β οΈ WARNING: Understand risks that running RA has no cluster protection while the cluster is in maintenance mode and restarting
π configure
Configure the SBD daemon for both the disk-based and the disk-less mode.
Main functionailities include:
- Show configured disk metadata
- Show contents of
/etc/sysconfig/sbd - Show SBD related cluster properties
- Update the SBD related configuration parameters
- NOTE:
sbd crashdumpis used for debugging. Understand the risks and runcrm sbd purge crashdumpafterward π
For more details on SBD and related parameters, please see man sbd(8).
Usage:
# For disk-based SBD
crm sbd configure show [disk_metadata|sysconfig|property]
crm sbd configure [watchdog-timeout=<integer>] [allocate-timeout=<integer>] [loop-timeout=<integer>] [msgwait-timeout=<integer>] [crashdump-watchdog-timeout=<integer>] [watchdog-device=<device|driver>]
# For disk-less SBD
crm sbd configure show [sysconfig|property]
crm sbd configure [watchdog-timeout=<integer>] [crashdump-watchdog-timeout=<integer>] [watchdog-device=<device|driver>]
example:
configure show
configure show disk_metadata
configure show sysconfig
configure show property
configure watchdog-timeout=30
π¦ device
Add or remove SBD device(s) from the existing SBD configuration. That's it, that's the vibe β¨
example:
device add /dev/sdb5
device add /dev/sdb5 /dev/sdb6
device add "/dev/sda5;/dev/sda6"
device remove /dev/sdb5
π status
Show the runtime status of the SBD daemon and the other information of those SBD related components, ie. watchdog, fence agent. Basically the glow-up report card for your SBD stack π«Ά
Usage:
status
πΈ purge
Disable the systemd sbd.service on all cluster nodes, move the sbd sysconfig to .bak and adjust SBD related cluster properties. And if crashdump is specified, the crashdump related configurations will be removed too. Clean slate era π
Usage:
purge
purge crashdump
π node β Node management
Node management and status commands. Everything you wanna do to your nodes lives right here π
β attribute
Edit node attributes. This kind of attribute should refer to relatively static properties, such as memory size. (Static bestie energy, not the chaotic volatile stuff.)
Usage:
attribute <node> set <attr> <value>
attribute <node> delete <attr>
attribute <node> show <attr>
Example:
attribute node_1 set memory_size 4096
π clearstate
Resets and clears the state of the specified node. This node is afterwards assumed clean and offline. This command can be used to manually confirm that a node has been fenced (e.g., powered off).
π¨ Be careful! This can cause data corruption if you confirm that a node is down that is, in fact, not cleanly down β the cluster will proceed as if the fence had succeeded, possibly starting resources multiple times. Like, actually read that twice, bestie π
Usage:
clearstate <node>
π delete
Remove a node from cluster.
If the node is still listed as active and a member of our partition we refuse to remove it. With the global force option (-F) we will try to delete the node anyway.
Usage:
delete <node>
Deprecation note π
This command is deprecated and in favor of crm cluster remove [-F] -c <node>, which will adjust the related cluster configurations and clean up the leftover (eg. stopping the cluster services) on the removed node.
π₯ fence
Make CRM fence a node. This functionality depends on stonith resources capable of fencing the specified node. No such stonith resources, no fencing will happen β it's giving "no stonith, no party" π
Usage:
fence <node>
π§ maintenance
Set the node status to maintenance. This is equivalent to the cluster-wide maintenance-mode property but puts just one node into the maintenance mode. If there are maintained resources on the node, the user will be proposed to remove the maintenance property from them.
The node parameter defaults to the node where the command is run.
Usage:
maintenance [<node>]
π online
Usage:
online [--all | <node>... ]
Specify node(s) on which to online node. If no nodes are specified, online node on the local node. If --all is specified, online node on all nodes.
Options:
-h,--helpβ Show this help message--allβ To online node on all nodes
π ready
Set the node's maintenance status to off. The node should be now again fully operational and capable of running resource operations. Welcome back to the main character roster β¨
The node parameter defaults to the node where the command is run.
Usage:
ready [<node>]
π¦ server
Remote nodes may have a configured server address which should be used when contacting the node. This command prints the server address if configured, else the node name.
If no parameter is given, the addresses or names for all nodes are printed.
Usage:
server [<node> ...]
π show
Show a node definition. If the node parameter is omitted, then all nodes are shown.
Usage:
show [<node>]
πΈ standby
Usage:
standby [--all | <node>... ] [lifetime]
Specify node(s) on which to standby node. If no nodes are specified, standby node on the local node. If --all is specified, standby node on all nodes.
Additionally, you may specify a lifetime for the standby---if set to "reboot", the node will be back online once it reboots. "forever" will keep the node in standby after reboot. The life time defaults to "forever".
Options:
-h,--helpβ Show this help message--allβ To standby node on all nodes
π status-attr
Edit node attributes which are in the CIB status section, i.e., attributes which hold properties of a more volatile nature. One typical example is attribute generated by the pingd utility. (Yes this is the chaotic opposite of attribute β volatile queen behavior π«Ά)
Usage:
status-attr <node> set <attr> <value>
status-attr <node> delete <attr>
status-attr <node> show <attr>
Example:
status-attr node_1 show pingd
π utilization
Edit node utilization attributes. These attributes describe hardware characteristics as integer numbers such as memory size or the number of CPUs. By setting the placement-strategy cluster property appropriately, it is possible then to distribute resources based on resource requirements and node size. See also resource utilization attributes.
Usage:
utilization <node> set <attr> <value>
utilization <node> delete <attr>
utilization <node> show <attr>
Examples:
utilization node_1 set memory 16384
utilization node_1 show cpu
π site β GEO clustering site support
A cluster may consist of two or more subclusters in different and distant locations. This set of commands supports such setups. Long-distance relationship but make it highly available π«
π« ticket
Tickets are cluster-wide attributes. They can be managed at the site where this command is executed.
It is then possible to constrain resources depending on the ticket availability (see the rsc_ticket command for more details).
Usage:
ticket {grant|revoke|standby|activate|show|time|delete} <ticket>
Example:
ticket grant ticket1
β¨ options β User preferences
The user may set various options for the crm shell itself. Glow-up your CLI, bestie π
π add-quotes
The shell (as in /bin/sh) parser strips quotes from the command line. This may sometimes make it really difficult to type values which contain white space. One typical example is the configure filter command. The crm shell will supply extra quotes around arguments which contain white space. The default is yes.
Note on quotes use π
Adding quotes around arguments automatically has been introduced with version 1.2.2 and it is technically a regression. Being a regression is the only reason the add-quotes option exists. If you have custom shell scripts which would break, just set the add-quotes option to no.
For instance, with adding quotes enabled, it is possible to do the following:
# crm configure primitive d1 Dummy \
meta description="some description here"
# crm configure filter 'sed "s/hostlist=./&node-c /"' fencing
π check-frequency
Semantic check of the CIB or elements modified or created may be done on every configuration change (always), when verifying (on-verify) or never. It is by default set to always. Experts may want to change the setting to on-verify.
The checks require that resource agents are present. If they are not installed at the configuration time set this preference to never.
See Configuration semantic checks for more details.
π¦ check-mode
Semantic check of the CIB or elements modified or created may be done in the strict mode or in the relaxed mode. In the former certain problems are treated as configuration errors. In the relaxed mode all are treated as warnings. The default is strict.
See Configuration semantic checks for more details.
π colorscheme
With output set to color, a comma separated list of colors from this option are used to emphasize:
- keywords
- object ids
- attribute names
- attribute values
- scores
- resource references
crm can show colors only if there is curses support for python installed (usually provided by the python-curses package). The colors are whatever is available in your terminal. Use normal if you want to keep the default foreground color.
This user preference defaults to yellow,normal,cyan,red,green,magenta β and honestly? That combo is chef's kiss for terminals with a dark background π. If your terminal is doing a different aesthetic, go ahead and change the color scheme and save it in the preferences file, bestie.
Example:
colorscheme yellow,normal,blue,red,green,magenta
editorβ theeditcommand invokes an editor, and this is where you say which editor. If you don't set it, it defaults to either the value of theEDITORenvironment variable or one of the standard UNIX editors (vi,emacs,nano). No cap, it just picks one.
Usage:
editor program
Example:
editor vim
manage-childrenβ okay so some resource management commands, likeresource stop, can be kinda messy when the target resource is a group. Each element, group and primitive members alike, can have a meta-attribute, and those attributes might end up with values that clash. Consider this construct:
crm(live)# configure show svc fs virtual-ip
primitive fs Filesystem \
params device="/dev/drbd0" directory="/srv/nfs" fstype=ext3 \
op monitor interval=10s \
meta target-role=Started
primitive virtual-ip IPaddr2 \
params ip=10.2.13.110 iflabel=1 \
op monitor interval=10s \
op start interval=0 \
meta target-role=Started
group svc fs virtual-ip \
meta target-role=Stopped
Like⦠the element svc should be stopped, but the group is actually running because all its members have target-role set to Started:
crm(live)# resource show svc
resource svc is running on: xen-f
So when the user runs resource stop svc, the intention is genuinely not clear π. This preference gives you a way to control what happens when group members' attribute values conflict with the same attribute on the group itself.
Possible values are ask (the default), always, and never. Set it to always and the crm shell removes all children attributes whose values differ from the parent. Set it to never and all children attributes are left intact. And if it's ask, the user gets asked for each member what should be done. Slay, informed consent π
.
outputβcrmcan adorn configurations two ways: in color (kinda likels --color) and by showing keywords in UPPER CASE. Possible values areplain,color-always,color, anduppercase. You can absolutely combineuppercasewith one of the color values for a truly uppercase xmass tree π. Just set this option tocolor,uppercaseorcolor-always,uppercase. And if you need color codes in pipes,color-alwaysforces color codes even when the terminal is not a tty (exactly likels --color=always).pagerβ theviewcommand displays text through a pager, and this is where you pick your fave pager program. If not set, it defaults to either the value of thePAGERenvironment variable or one of the standard UNIX system pagers (less,more,pg).resetβ resets all user options to the defaults. And if you use it as a single-shot command, the rc file ($HOME/.config/crm/rc) is reset to the defaults too. Fresh start energy β¨.saveβ saves current settings to the rc file ($HOME/.config/crm/rc). On furthercrmruns, that rc file is automatically read and parsed. Set it and forget it π«Ά.setβ sets the value of an option. Takes the fully qualified name of the option as its argument, exactly as displayed byshow all.
The modified option value is stored in the user-local configuration file, usually found in ~/.config/crm/crm.conf.
Usage:
set <option> <value>
Example:
set color.warn "magenta bold"
set editor nano
showβ displays all current settings.
Give it an option name as an argument and show displays only the value of that argument.
Give it all as the argument and show displays all available user options.
Usage:
show [all|<option>]
Example:
show
show skill-level
show all
skill-levelβ based on theskill-levelsetting, the user is allowed to use only a subset of commands. There are three levels:operator,administrator, andexpert. The operator level allows only commands at the resource and node levels β but not editing or deleting resources. The administrator may do that, and may also configure the cluster at the configure level and manage the shadow CIBs. The expert may do all. Main character energy only for experts π.
Usage:
skill-level <level>
level :: operator | administrator | expert
π Note on security
The skill-level option is advisory only. There is literally nothing stopping any user from changing their skill level (see Access Control Lists (ACL) on how to enforce access control). So likeβ¦ it's a vibe, not a lock π.
sort-elementsβcrmby default sorts CIB elements. If you want them to appear in the order they were created, set this option tono.
Usage:
sort-elements {yes|no}
Example:
sort-elements no
userβ sufficient privileges are necessary in order to manage a cluster: programs such ascrm_verifyorcrm_resourceand, ultimately,cibadminhave to be run either as root or as the CRM owner user (typicallyhacluster). You don't have to worry about any of that if you runcrmas root. But a more secure way is to run the program with your usual privileges, set this option to the appropriate user (such ashacluster), and set up the sudoers file.
Usage:
user system-user
Example:
user hacluster
waitβ in normal operation,crmruns a command and gets back immediately to process other commands or get input from the user. With this option set toyes, it will wait for the started transition to finish. In interactive mode, dots are printed to indicate progress. Cute little progress dots π«§.
Usage:
wait {yes|no}
Example:
wait yes
π οΈ configure β CIB configuration π οΈ
This level enables all the CIB object definition commands. Big config energy.
The configuration can be logically divided into four parts: nodes, resources, constraints, and (cluster) properties and attributes. Each of these commands supports one or more basic CIB objects.
Nodes and attributes describing nodes are managed using the node command.
Commands for resources are:
primitivemonitorgroupclone(promotable clones)
And in order to streamline large configurations, you can define a template that primitives can reference later:
rsc_template
In that case, the primitive inherits all attributes defined in the template. Inheritance, we love to see it π.
There are three types of constraints:
locationcolocationorder
It's also possible to define fencing order (stonith resource priorities):
fencing_topology
Finally, there are the cluster properties, resource meta-attributes defaults, and operations defaults. All of them are just a set of attributes. These attributes are managed by the following commands:
propertyrsc_defaultsop_defaults
In addition to the cluster configuration, Access Control Lists (ACL) can be set up to allow access to parts of the CIB for users other than root and hacluster. The following commands manage ACL:
userrole
And in Pacemaker 1.1.12 and up, this command replaces the user command for handling ACLs:
acl_target
The changes are applied to the current CIB only on ending the configuration session or using the commit command. Don't forget to commit, bestie π.
Comments start with # in the first line. The comments are tied to the element which follows β so if the element moves, its comments follow it. Ride or die π¦.
acl_target
Defines an ACL target.
Usage:
acl_target <tid> [<role> ...]
Example:
acl_target joe resource_admin constraint_editor
alert
Version note π This feature is only available in Pacemaker 1.1.15+.
Event-driven alerts let you call scripts whenever interesting events occur in the cluster (nodes joining or leaving, resources starting or stopping, etc.). Literally whenever.
The path is an arbitrary file path to an alert script. Existing external scripts used with ClusterMon resources can be used as alert scripts, since the interface is compatible. Reuse, iconique.
Each alert may have a number of recipients configured. These get passed to the script as arguments. The first recipient is also passed as the CRM_alert_recipient environment variable, for compatibility with existing scripts that only support one recipient.
The available meta-attributes are timeout (default 30s) and timestamp-format (default "%H:%M:%S.%06N").
Some configurations may require each recipient to be delimited by brackets, to avoid ambiguity. In the example alert-2 below, the meta attribute for timeout is defined after the recipient, so the brackets are used to make sure the meta attribute is set for the alert and not just the recipient. You can avoid this whole situation by setting any alert attributes before defining the recipients. Pro tip from the manpage itself π«Ά.
Usage:
alert <id> <path> \
[attributes <nvpair> ...] \
[meta <nvpair> ...] \
[select [nodes | fencing | resources | attributes '{' <attribute> ... '}' ] ...] \
[to [{] <recipient>
[attributes <nvpair> ...] \
[meta <nvpair> ...] [}] \
...]
Example:
alert alert-1 /srv/pacemaker/pcmk_alert_sample.sh \
to /var/log/cluster-alerts.log
alert alert-2 /srv/pacemaker/example_alert.sh \
meta timeout=60s \
to { /var/log/cluster-alerts.log }
alert alert-3 /srv/pacemaker/example_alert.sh \
select fencing \
to { /var/log/fencing-alerts.log }
bundle
A bundle is a single resource specifying the settings, networking requirements, and storage requirements for any number of containers generated from the same container image. Bundle of joy, literally π.
Pacemaker bundles support Docker and Podman container technologies.
A bundle must contain exactly one docker or podman element. Not zero, not two. One.
The bundle definition may contain a reference to a primitive resource which defines the resource running inside the container.
Example:
primitive httpd-apache ocf:heartbeat:apache
bundle httpd \
docker image=pcmk:httpd replicas=3 \
network ip-range-start=10.10.10.123 host-netmask=24 \
port-mapping port=80 \
storage \
storage-mapping target-dir=/var/www/html source-dir=/srv/www options=rw \
primitive httpd-apache
π§ cib
This level is literally for managing shadow CIBs. Itβs available at the configure level so you can save intermediate changes to a shadow CIB instead of yeeting them straight into the live cluster. This tiny excerpt shows the vibe:
crm(live)configure# cib new test-2
INFO: test-2 shadow CIB created
crm(test-2)configure# commit
Notice how the current CIB in the prompt switched from live to test-2 after you ran cib new. Chefβs kiss. Also check the CIB shadow management section for more info, bestie.
π§ cibstatus
Hop into edit-and-manage mode for the CIB status section level. More deets live in the CIB status management section. Slay.
𧬠clone
The clone command creates a resource clone. It can contain a single primitive resource or one group of resources. No cap.
Promotable clones are clone resources carrying the promotable=true meta-attribute for the given promotable resources. This is used to deprecate the master-slave resources. Periodt.
Usage:
clone <name> <rsc>
[description=<description>]
[meta <attr_list>]
[params <attr_list>]
attr_list :: [$id=<id>] <attr>=<val> [<attr>=<val>...] | $id-ref=<id>
Example:
clone cl_fence apc_1 \
meta clone-node-max=1 globally-unique=false
clone disk1 drbd1 \
meta promotable=true notify=true globally-unique=false
π colocation (collocation)
This constraint expresses the placement relationship between two or more resources. If there are more than two resources, the constraint is called a resource set. Iconic.
The score is how you indicate the priority of the constraint. A positive score means the resources should run on the same node. A negative score means they should not run on the same node. Values of positive or negative infinity indicate a mandatory constraint. So yeah, infinity is giving βthis is not a drill.β
In the two-resource form, the cluster will place <with-rsc> first, and then decide where to put the <rsc> resource.
Collocation resource sets have an extra attribute (sequential) to allow for sets of resources which donβt depend on each other in terms of state. The shell syntax for such sets is to put resources in parentheses.
Sets cannot be nested. Thatβs the rule, bestie.
The optional node-attribute can be used to colocate resources on a set of nodes and not necessarily on the same node. For example, by setting a node attribute color on all nodes and setting the node-attribute value to color as well, the colocated resources will be placed on any node that has the same color. Cute and functional.
For more details on how to configure resource sets, see Syntax: Resource sets.
Usage:
colocation <id> <score>: <rsc>[:<role>] <with-rsc>[:<role>]
[node-attribute=<node_attr>]
colocation <id> <score>: <resource_sets>
[node-attribute=<node_attr>]
resource_sets :: <resource_set> [<resource_set> ...]
resource_set :: ["("|"["] <rsc>[:<role>] [<rsc>[:<role>] ...] \
[<attributes>] [")"|"]"]
attributes :: [require-all=(true|false)] [sequential=(true|false)]
Example:
colocation never_put_apache_with_dummy -inf: apache dummy
colocation c1 inf: A ( B C )
β
commit
Commit the current configuration to the CIB in use. As noted elsewhere, commands in a configure session donβt have immediate effect on the CIB. All changes are applied at one point in time, either using commit or when the user leaves the configure level. In case the CIB in use changed in the meantimeβpresumably by somebody elseβthe crm shell will refuse to apply the changes. Rude but valid.
If you know that itβs fine to still apply them, add force to the command line.
To disable CIB patching and apply the changes by replacing the CIB completely, add replace to the command line. Note that this can lead to previous changes being overwritten if some other process concurrently modifies the CIB. So like, be aware, bestie.
Usage:
commit [force] [replace]
β±οΈ default-timeouts
This command takes the timeouts from the actions section of the resource agent meta-data and sets them for the operations of the primitive. Itβs giving βcopy-paste the timeouts for me.β
Usage:
default-timeouts <id> [<id>...]
Note on default-timeouts: The use of this command is discouraged in favor of manually determining the best timeouts required for the particular configuration. Relying on the resource agent to supply appropriate timeouts can cause the resource to fail at the worst possible moment. π Appropriate timeouts for resource actions are context-sensitive, and should be carefully considered with the whole configuration in mind. Fr fr.
ποΈ delete
Delete one or more objects. If an object to be deleted belongs to a container object, such as a group, and it is the only resource in that container, then the container is deleted as well. Any related constraints are removed as well. Itβs a whole cleanup moment.
If the object is a started resource, it will not be deleted unless the --force flag is passed to the command.
Usage:
delete [--force] <id> [<id>...]
βοΈ edit
This command invokes the editor with the object description. As with the show command, the user may choose to edit all objects or a set of objects.
If the user insists, he or she may edit the XML edition of the object. If you do that, donβt modify any id attributes. Not even a little. π
Usage:
edit [xml] [<id> ...]
edit [xml] changed
Note on renaming element ids: Theeditcommand sometimes cannot properly handle modifying element ids. In particular for elements which belong togroupor promotable resources. Group and promotable resources themselves also cannot be renamed. Please use therenamecommand instead. Trust.
π§Ή erase
The erase clears all configuration. Apart from nodes. To remove nodes, you have to specify an additional keyword nodes.
Note that removing nodes from the live cluster may have some strange/interesting/unwelcome effects. π So yeah, vibe check before you do that.
Usage:
erase [nodes]
π‘οΈ fencing_topology
If multiple fencing (stonith) devices are available capable of fencing a node, their order may be specified by fencing_topology. The order is specified per node.
Stonith resources can be separated by ,, in which case all of them need to succeed. If they fail, the next stonith resource (or set of resources) is used. In other words, use comma to separate resources which all need to succeed and whitespace for serial order. It is not allowed to use whitespace around comma. Thatβs the boundary, bestie.
If the node is left out, the order is used for all nodes. That should reduce the configuration size in some stonith setups.
From Pacemaker version 1.1.14, it is possible to use a node attribute as the target in a fencing topology. The syntax for this usage is described below.
From Pacemaker version 1.1.14, it is also possible to use regular expression patterns as the target in a fencing topology. The configured fencing sequence then applies to all devices matching the pattern. RegEx girlies rise.
Usage:
fencing_topology <stonith_resources> [<stonith_resources> ...]
fencing_topology <fencing_order> [<fencing_order> ...]
fencing_order :: <target> <stonith_resources> [<stonith_resources> ...]
stonith_resources :: <rsc>[,<rsc>...]
target :: <node>: | attr:<node-attribute>=<value> | pattern:<pattern>
Example:
# Only kill the power if poison-pill fails
fencing_topology poison-pill power
# As above for node-a, but a different strategy for node-b
fencing_topology \
node-a: poison-pill power \
node-b: ipmi serial
# Fencing anything on rack 1 requires fencing via both APC 1 and 2,
# to defeat the redundancy provided by two separate UPS units.
fencing_topology attr:rack=1 apc01,apc02
# Fencing for all machines named green.* is done using the pear
# fencing device first, while all machines named red.* are fenced
# using the apple fencing device first.
fencing_topology \
pattern:green.* pear apple \
pattern:red.* apple pear
π«§ filter
This command filters the given CIB elements through an external program. The program should accept input on stdin and send output to stdout (the standard UNIX filter conventions). As with the show command, the user may choose to filter all or just a subset of elements.
It is possible to filter the XML representation of objects, but probably not as useful as the configuration language. The presentation is somewhat different from what would be displayed by the show commandβeach element is shown on a single line, i.e., there are no backslashes and no other embellishments.
Donβt forget to put quotes around the filter if it contains spaces. Quotes are main character energy here.
Usage:
filter <prog> [xml] [<id> ...]
filter <prog> [xml] changed
Examples:
filter "sed '/^primitive/s/target-role=[^ ]*//'"
# crm configure filter "sed '/^primitive/s/target-role=[^ ]*//'"
crm configure <<END
filter "sed '/threshold=\"1\"/s/=\"1\"/=\"0\"/g'"
END
Note on quotation marks: Filter commands which feature a blend of quotation marks can be difficult to get right, especially when used directly frombash, sincebashdoes its own quotation parsing. In these cases, it can be easier to supply the filter command as standard input. See the last example above. Iykyk.
π get-property
Show the value of the given property. If the value is not set, the command will print the default value for the property, if known.
If no property name is passed to the command, the list of known cluster properties is printed.
If the property is set multiple times, for example using multiple property sets with different rule expressions, the output of this command is undefined. So like, donβt rely on it in that case, bestie.
Pass the argument -t or --true to get-property to translate the argument value into true or false. If the value is not set, the command will print false. Simple, iconic, done.
Usage:
get-property [-t|--true] [<name>]
Example:
get-property stonith-enabled
get-property -t maintenance-mode
πΈοΈ graph
Make a graphviz graphical layout out of the cluster config you've got right now. Iconic behavior honestly.
Right now the only thing supported is dot (directed graph). It's basically a visualization of how resources are ordered. Fr fr.
The graph can be saved to a file which you can then use as source for all kinds of graphviz tools (by default though, it just pops up in the user's X11 session). And optionally, if you specify the format, you can produce an image instead. β¨
If you want more or different graphviz attributes, you can save the default set of attributes to an ini file. If that file exists it will always override the builtin settings β no cap. The exportsettings subcommand also prints out where the ini file lives, so you can find it. π
Usage:
graph [<gtype> [<file> [<img_format>]]]
graph exportsettings
gtype :: dot
img_format :: `dot` output format (see the `-T` option)
Example:
graph dot
graph dot clu1.conf.dot
graph dot clu1.conf.svg svg
π«§ group
The group command creates a group of resources. Super useful when resources depend on other resources and need those resources to start in order on the same node. A common use of resource groups is making sure a server and a virtual IP are located together, and that the virtual IP starts before the server. π
Grouped resources are started in the order they appear in the group, and stopped in reverse order. And heads up β if a resource in the group can't run anywhere, the resources after it in the group will not start. π
Usage:
group <name> <rsc> [<rsc>...]
[description=<description>]
[meta attr_list]
[params attr_list]
attr_list :: [$id=<id>] <attr>=<val> [<attr>=<val>...] | $id-ref=<id>
Example:
group internal_www disk0 fs0 internal_ip apache \
meta target_role=stopped
π₯ load
Load part of your configuration (or literally all of it) from a local file or a network URL. Let's break down the methods, bestie:
replacereplaces the current configuration with the one from the source.updatetries to import the contents into the current configuration.pushimports the contents into the current configuration and removes any lines that aren't present in the given configuration.
The file may be a CLI file or an XML file.
And if the URL is -, the configuration gets read from standard input. π
Usage:
load [xml] <method> URL
method :: replace | update | push
Example:
load xml update myfirstcib.xml
load xml replace http://storage.big.com/cibs/bigcib.xml
load xml push smallcib.xml
π location
location defines the preference of nodes for a given resource. Location constraints are defined by a single rule which specifies a score to be awarded if the rule matches. Simple as that. π
The resource referenced by the location constraint can be any one of these:
- Plain resource reference:
location loc1 webserver 100: node1 - Resource set in curly brackets:
location loc1 { virtual-ip webserver } 100: node1 - Tag containing resource ids:
location loc1 tag1 100: node1 - Resource pattern:
location loc1 /web.*/ 100: node1
The resource-discovery attribute lets probes be selectively enabled or disabled per resource and node. π
The syntax for resource sets is described in detail for colocation.
For more details on how to configure resource sets, see Syntax: Resource sets.
For more information on rule expressions, see Syntax: Rule expressions.
Note: pacemaker has deprecated support for multiple top-level rules within a location constraint since version 2.1.8. So likeβ¦ don't. π
Usage:
location <id> <rsc> [<attributes>] {<node_pref>|<rule>}
rsc :: /<rsc-pattern>/
| { resource_sets }
| <rsc>
attributes :: role=<role> | resource-discovery=always|never|exclusive
node_pref :: <score>: <node>
rule ::
rule [id_spec] [$role=<role>] <score>: <expression>
id_spec :: $id=<id> | $id-ref=<id>
score :: <number> | <attribute> | [-]inf
expression :: <simple_exp> [<bool_op> <simple_exp> ...]
bool_op :: or | and
simple_exp :: <attribute> [type:]<binary_op> <value>
| <unary_op> <attribute>
| date <date_expr>
type :: string | version | number
binary_op :: lt | gt | lte | gte | eq | ne
unary_op :: defined | not_defined
date_expr :: lt <end>
| gt <start>
| in start=<start> end=<end>
| in start=<start> <duration>
| spec <date_spec>
duration|date_spec ::
hours=<value>
| monthdays=<value>
| weekdays=<value>
| yearsdays=<value>
| months=<value>
| weeks=<value>
| years=<value>
| weekyears=<value>
Examples:
location conn_1 internal_www 100: node1
location conn_1 internal_www \
rule 50: #uname eq node1 and \
defined pingd
location conn_2 dummy_float \
rule -inf: not_defined pingd or pingd number:lte 0
# never probe for rsc1 on node1
location no-probe rsc1 resource-discovery=never -inf: node1
π§© modgroup
Add or remove primitives in a group. The add subcommand appends the new group member by default β but if it should go somewhere else, there are after and before clauses for that. πΈ
Usage:
modgroup <id> add <id> [after <id>|before <id>]
modgroup <id> remove <id>
Examples:
modgroup share1 add storage2 before share1-fs
π monitor
monitor is by far the most common operation. And good news β you can add it without editing the whole resource. Also, long primitive definitions can get a bit uncluttered this way. To keep this command as concise as possible, less common operation attributes aren't available β if you need those, use the op part of the primitive command instead. π¦
Usage:
monitor <rsc>[:<role>] <interval>[:<timeout>]
Example:
monitor apcfence 60m:60s
Note that after running the command, the monitor operation may show up as part of the primitive definition.
π₯οΈ node
The node command describes a cluster node. Nodes in the CIB are commonly created automatically by the CRM. So you shouldn't need to deal with nodes unless you also want to define node attributes. Also note that it's possible to manage node attributes at the node level too. π
Usage:
node [$id=<id>] <uname>[:<type>]
[description=<description>]
[attributes [$id=<id>] [<score>:] [rule...]
<param>=<value> [<param>=<value>...]] | $id-ref=<ref>
[utilization [$id=<id>] [<score>:] [rule...]
<param>=<value> [<param>=<value>...]] | $id-ref=<ref>
type :: member | remote
Example:
node node1
node big_node attributes memory=64
βοΈ op_defaults
Set defaults for the operations meta attributes. Periodt.
For more information on rule expressions, see Syntax: Rule expressions.
Usage:
op_defaults [$id=<set_id>] [rule ...] <option>=<value> [<option>=<value> ...]
Example:
op_defaults record-pending=true
π’ order
This constraint expresses the order of actions on two resources or more resources. If there are more than two resources, then the constraint is called a resource set. π
Ordered resource sets have an extra attribute that allows for sets of resources whose actions may run in parallel. The shell syntax for such sets is to put resources in parentheses.
If the subsequent resource can start or promote after any one of the resources in a set has done, enclose the set in brackets ([ and ]).
Sets cannot be nested. Just don't do it. π
Three strings are reserved to specify a kind of order constraint: Mandatory, Optional, and Serialize. It's preferred to use one of these settings instead of score. Previous versions mapped scores 0 and inf to the keywords advisory and mandatory. That is still valid but deprecated β so like, use the keywords, bestie.
For more details on how to configure resource sets, see Syntax: Resource sets.
Usage:
order <id> [kind:] first then [symmetrical=<bool>]
order <id> [kind:] resource_sets [symmetrical=<bool>]
kind :: Mandatory | Optional | Serialize
first :: <rsc>[:<action>]
then :: <rsc>[:<action>]
resource_sets :: resource_set [resource_set ...]
resource_set :: ["["|"("] <rsc>[:<action>] [<rsc>[:<action>] ...] \
[attributes] ["]"|")"]
attributes :: [require-all=(true|false)] [sequential=(true|false)]
Example:
order o-1 Mandatory: apache:start ip_1
order o-2 Serialize: A ( B C )
order o-4 first-resource then-resource
π§± primitive
The primitive command describes a resource. It may be referenced only once in group, or clone objects. If it's not referenced, then it gets placed as a single resource in the CIB. π
Operations may be specified anonymously, as a group, or by reference:
- "Anonymous" β as a list of
opspecifications. Use this method if you don't need to reference the set of operations elsewhere. This is the most common way to define operations. - If reusing operation sets is what you want, use the
operationskeyword along with anidto give the operations set a name. Use theoperationskeyword and anid-refvalue set to theidof another operations set, to apply that same set of operations to this primitive. π
Operation attributes that aren't recognized get saved as instance attributes of that operation. A typical example is OCF_CHECK_LEVEL.
For multistate resources, roles are specified as role=<role>. The Master/Slave resources are deprecated and replaced by Promoted/Unpromoted promotable resources if desired. π
okay so if youβve got resources that are the same type and share most of their config, you can define a template for them. See rsc_template for the deets. π«Ά
Attributes that hold time values β like the interval attribute on operations β get set either as a plain number, which is interpreted as a time in seconds, or with one of these suffixes:
s,secβ time in seconds (same as no suffix)ms,msecβ time in millisecondsus,usecβ time in microsecondsm,minβ time in minutesh,hrβ time in hours
Usage:
primitive <rsc> {[<class>:[<provider>:]]<type>|@<template>}
[description=<description>]
[[params] attr_list]
[meta attr_list]
[utilization attr_list]
[operations id_spec]
[op op_type [<attribute>=<value>...]
[[op_params] attr_list]
[op_meta attr_list] ...]
attr_list :: [$id=<id>] [<score>:] [rule...]
<attr>=<val> [<attr>=<val>...]] | $id-ref=<id>
id_spec :: $id=<id> | $id-ref=<id>
op_type :: start | stop | monitor
Example:
primitive apcfence stonith:apcsmart \
params ttydev=/dev/ttyS0 hostlist="node1 node2" \
op start timeout=60s \
op monitor interval=30m timeout=60s
primitive www8 apache \
configfile=/etc/apache/www8.conf \
operations $id-ref=apache_ops
primitive db0 mysql \
params config=/etc/mysql/db0.conf \
op monitor interval=60s \
op monitor interval=300s OCF_CHECK_LEVEL=10
primitive r0 ocf:linbit:drbd \
params drbd_resource=r0 \
op monitor role=Promoted interval=60s \
op monitor role=Unpromoted interval=300s
primitive xen0 @vm_scheme1 xmfile=/etc/xen/vm/xen0
primitive mySpecialRsc Special \
params 3: rule #uname eq node1 interface=eth1 \
params 2: rule #uname eq node2 interface=eth2 port=8888 \
params 1: interface=eth0 port=9999
primitive A ocf:pacemaker:Dummy \
op start \
op_meta 2: rule #ra-version version:gt 1.0 timeout=120s \
op_meta 1: timeout=60s
π Note on id-ref usage
Instance or meta attributes (params and meta) may contain a reference to another set of attributes. In that case, no other attributes are allowed. Since attribute setsβ ids, though they do exist, are not shown in the crm, it is also possible to reference an object instead of an attribute set. crm will automatically replace such a reference with the right id:
crm(live)configure# primitive a2 www-2 meta $id-ref=a1
crm(live)configure# show a2
primitive a2 apache \
meta $id-ref=a1-meta_attributes
[...]
It is advisable to give meaningful names to attribute sets which are going to be referenced. β¨
β¨ property
Set cluster configuration properties. When setting the maintenance-mode property, it will inform the user if there are nodes or resources that have the maintenance property.
If no property name is passed to the command, the list of known cluster properties is printed.
To print one propertyβs help, use the --help option; or use Tab to complete the help text for the property on interactive mode.
For more information on rule expressions, see Syntax: Rule expressions.
Usage:
property [<set_id>:] [rule ...] <option>=<value> [<option>=<value> ...]
Example:
property stonith-enabled --help
property stonith-enabled=true
property rule date spec years=2014 stonith-enabled=false
π¬ ptest (simulate)
Show PE (Policy Engine) motions using ptest(8) or crm_simulate(8).
A CIB is constructed using the current user edited configuration and the status from the running CIB. The resulting CIB is run through ptest (or crm_simulate) to show changes which would happen if the configuration is committed.
The status section may be loaded from another source and modified using the cibstatus level commands. In that case, the ptest command will issue a message informing the user that the Policy Engine graph is not calculated based on the current status section and therefore wonβt show what would happen to the running but some imaginary cluster.
If you have graphviz installed and X11 session, dotty(1) is run to display the changes graphically.
Add a string of v characters to increase verbosity. ptest can also show allocation scores. utilization turns on information about the remaining capacity of nodes. With the actions option, ptest will print all resource actions.
The ptest program has been replaced by crm_simulate in newer Pacemaker versions. In some installations both could be installed. Use simulate to enfore using crm_simulate.
Usage:
ptest [nograph] [v...] [scores] [actions] [utilization]
Examples:
ptest scores
ptest vvvvv
simulate actions
π refresh
Refresh the internal structures from the CIB. All changes made during this session are lost. π
Usage:
refresh
π·οΈ rename
Rename an object. It is recommended to use this command to rename a resource, because it will take care of updating all related constraints and a parent resource. Changing ids with the edit command wonβt have the same effect.
π¨ If you want to rename a resource, it must be in the stopped state.
Usage:
rename <old_id> <new_id>
π role
An ACL role is a set of rules which describe access rights to CIB. Rules consist of an access right read, write, or deny and a specification denoting part of the configuration to which the access right applies. The specification can be an XPath or a combination of tag and id references. If an attribute is appended, then the specification applies only to that attribute of the matching element.
There is a number of shortcuts for XPath specifications. The meta, params, and utilization shortcuts reference resource meta attributes, parameters, and utilization respectively. The location may be used to specify location constraints most of the time to allow resource move and unmove commands. The property references cluster properties. The node allows reading node attributes. nodeattr and nodeutil reference node attributes and node capacity (utilization). The status shortcut references the whole status section of the CIB. Read access to status is necessary for various monitoring tools such as crm_mon(8) (aka crm status).
For more information on rule expressions, see Syntax: Rule expressions.
Usage:
role <role-id> rule [rule ...]
rule :: acl-right cib-spec [attribute:<attribute>]
acl-right :: read | write | deny
cib-spec :: xpath-spec | tag-ref-spec
xpath-spec :: xpath:<xpath> | shortcut
tag-ref-spec :: tag:<tag> | ref:<id> | tag:<tag> ref:<id>
shortcut :: meta:<rsc>[:<attr>]
params:<rsc>[:<attr>]
utilization:<rsc>
location:<rsc>
property[:<attr>]
node[:<node>]
nodeattr[:<attr>]
nodeutil[:<node>]
status
Example:
role app1_admin \
write meta:app1:target-role \
write meta:app1:is-managed \
write location:app1 \
read ref:app1
π rsc_defaults
Set defaults for the resource meta attributes.
For more information on rule expressions, see Syntax: Rule expressions.
Usage:
rsc_defaults [<set_id>:] [rule ...] <option>=<value> [<option>=<value> ...]
Example:
rsc_defaults failure-timeout=3m
π§ rsc_template
The rsc_template command creates a resource template. It may be referenced in primitives. It is used to reduce large configurations with many similar resources.
Usage:
rsc_template <name> [<class>:[<provider>:]]<type>
[description=<description>]
[params attr_list]
[meta attr_list]
[utilization attr_list]
[operations id_spec]
[op op_type [<attribute>=<value>...] ...]
attr_list :: [$id=<id>] <attr>=<val> [<attr>=<val>...] | $id-ref=<id>
id_spec :: $id=<id> | $id-ref=<id>
op_type :: start | stop | monitor
Example:
rsc_template public_vm Xen \
op start timeout=300s \
op stop timeout=300s \
op monitor interval=30s timeout=60s \
op migrate_from timeout=600s \
op migrate_to timeout=600s
primitive xen0 @public_vm \
params xmfile=/etc/xen/xen0
primitive xen1 @public_vm \
params xmfile=/etc/xen/xen1
π« rsc_ticket
This constraint expresses dependency of resources on cluster-wide attributes, also known as tickets. Tickets are mainly used in geo-clusters, which consist of multiple sites. A ticket may be granted to a site, thus allowing resources to run there.
The loss-policy attribute specifies what happens to the resource (or resources) if the ticket is revoked. The default is either stop or demote depending on whether a resource is multi-state.
See also the site set of commands.
Usage:
rsc_ticket <id> <ticket_id>: <rsc>[:<role>] [<rsc>[:<role>] ...]
[loss-policy=<loss_policy_action>]
loss_policy_action :: stop | demote | fence | freeze
Example:
rsc_ticket ticket-A_public-ip ticket-A: public-ip
rsc_ticket ticket-A_bigdb ticket-A: bigdb loss-policy=fence
rsc_ticket ticket-B_storage ticket-B: drbd-a:Promoted drbd-b:Promoted
π§ͺ rsctest
Test resources with current resource configuration. If no nodes are specified, tests are run on all known nodes.
The order of resources is significant: it is assumed that later resources depend on earlier ones.
If a resource is multi-state, it is assumed that the role on which later resources depend is Promoted. π
Tests run one at a time, sequentially, bestie β that's on purpose, so the same resource doesn't get spun up on two or more nodes at once π A test only actually happens if none of the nodes you named are currently running any of the resources you named. But heads up: it won't check whether those resources are running on the other nodes. π
Superuser privileges are, like, obviously required β either run this as root or set up the sudoers file appropriately. And ngl, resource testing can take a while, so maybe grab a snack. π
Usage:
rsctest <rsc_id> [<rsc_id> ...] [<node_id> ...]
Examples:
rsctest my_ip websvc
rsctest websvc nodeB
πΎ save
Saves the current configuration to a file β and optionally as XML, if that's your vibe. Pass - instead of a file name and the output goes to stdout instead. β¨
The save command takes the same selection arguments as the show command, so go peek at the show help section for the full deets.
Usage:
save [xml] [<id> | type:<type | tag:<tag> |
related:<obj> | changed ...] <file>
Example:
save myfirstcib.txt
save web-server server-config.txt
π schema
CIB's content gets validated by an RNG schema, and Pacemaker supports several of them depending on version. Wanna see all the supported schemas? Just hit TabTab after crm configure schema. Iconic.
β¨ Highly recommended: use the latest schema version. Like, please. π«Ά
Usage:
schema [<pacemaker-schema_version>]
Example:
# To get the schema version of the current CIB, or the latest version if no cluster configured yet
schema
# To set the new schema version
schema pacemaker-4.0
# Then need to run `commit` to make the change effective
# if it's on interactive mode
commit
π― set
Sets the value of an attribute that's already configured. The attribute has to be configured previously, and it can be an agent parameter, a meta attribute, a utilization value or an operation value. No cap.
The first argument is a path to the attribute β a dot-separated sequence that starts with the name of the resource or object and ends with the name of the attribute you're setting. β¨ To set an operation value, op_type should be specified; and when multiple operations exist (like multiple monitors), interval should be specified too. iykyk.
Usage:
set <path> <value>
path:: id.[op_type.][interval.]name
Examples:
set vip1.ip 192.168.20.5
set vm-a.force_stop 1
set vip1.monitor.on-fail ignore
set drbd.monitor.10s.interval 20s
π show
The show command displays CIB objects. With zero arguments it shows everything in the CIB, but the set of objects can be limited to just the ones with the given IDs, or by using one or more of the special prefixes described below. Love that for us. π
Pass xml as the first argument and you get the XML representation of the objects instead.
To show one or more specific objects, pass the object IDs as arguments.
To show all objects of a certain type, use the type: prefix.
To show all objects in a tag, use the tag: prefix.
To show all constraints related to a primitive β or all objects of a certain RA type β use the related: prefix.
To show all modified objects, pass the argument changed.
The prefixes can be stacked together on a single command line! For example, to show both the tag itself and the objects tagged by it, use: show tag:my-tag my-tag.
To refine a selection of objects using multiple modifiers, the keywords and and or are there for you. For example, to select all primitives tagged foo, use: show type:primitive and tag:foo.
To hide values when displaying the configuration, use the obscure:<glob> argument. This is super useful when sending the configuration over a public channel, so you don't expose potentially sensitive info. π The <glob> argument is a bash-style pattern matching attribute keys.
In /etc/crm/crm.conf, the obscure_pattern option is the persistent configuration of the CLI. For example, for high security concern:
[core]
obscure_pattern = passw* | ip
Which makes crm configure show equal to:
node-1:~ # crm configure show obscure:passw* obscure:ip
node 1084783297: node1
primitive fence_device stonith:fence_ilo5 \
params password="******"
primitive ip IPaddr2 \
params ip="******"
The default suggestion is passw*. If you don't want to obscure anything, just change the value to blank.
Usage:
show [xml] [<id>
| changed
| type:<type>
| tag:<id>
| related:<obj>
| obscure:<glob>
...]
type :: node | primitive | group | clone | rsc_template
| location | colocation | order
| rsc_ticket
| property | rsc_defaults | op_defaults
| fencing_topology
| role | user | acl_target
| tag
Example:
show webapp
show type:primitive
show xml tag:db tag:fs
show related:webapp
show related:IPaddr2
show related:ipad
show related:ocf:heartbeat:Dummy
show related:ocf:heartbeat:dum
show related:ocf
show related:heartbeat
show related:pacemaker
show related:suse
show related:stonith
show type:primitive obscure:passwd
π·οΈ tag
Defines a resource tag. A tag is an id that refers to one or more resources without implying any constraints between the tagged resources β it's purely conceptual grouping, okurrr. π
Usage:
tag <tag-name>: <rsc> [<rsc> ...]
tag <tag-name> <rsc> [<rsc> ...]
Example:
tag web: p-webserver p-vip
tag ips server-vip admin-vip
π template
The specified template gets loaded into the editor, and it's up to you to make a good CRM configuration out of it. π«Ά See also the template section.
Usage:
template [xml] url
Example:
template two-apaches.txt
β¬οΈ upgrade
Attempts to upgrade the CIB so it validates with the current version. Usually you need this when the error CIB not supported shows up β which typically means the active CIB version is coming from an older release. π
As a safety precaution, the force argument is required. Or you can use the crm -F option to do the force upgrade.
Usage:
upgrade <force>
Example:
upgrade force
π§βπ€βπ§ user
Users who normally can't view or manage cluster configuration can be allowed access to parts of the CIB. Access is defined by a set of read, write, and deny rules (just like in role definitions) β or by referencing roles, and that latter way is considered best practice. π
For more info on rule expressions, see Syntax: Rule expressions.
Usage:
user <uid> {roles|rules}
roles :: role:<role-ref> [role:<role-ref> ...]
rules :: rule [rule ...]
Example:
user joe \
role:app1_admin \
role:read_all
β validate-all
Calls the validate-all action for the resource, if possible.
Limitations β read these, bestie:
- The resource agent must implement the
validate-allaction. - The current user must be
root. - The primitive resource must not use nvpair references.
Usage:
validate-all <rsc>
π verify
Verifies the contents of the CIB that would be committed. Chef's kiss. β¨
Usage:
verify
π¦ xml
Even though we promised no xml, it may happen β hopefully very very seldom β that an element from the CIB can't be rendered in the configuration language. In that case, the element is shown as raw xml, prefixed by this command. You can then edit that element like any other, and if the shell figures out it can digest the change afterwards, it gets converted back into the normal configuration language. Otherwise? There's genuinely no need to use xml for configuration. π
Usage:
xml <xml>
π§ template β Import configuration from templates
User may be assisted in cluster configuration by templates prepared in advance. Templates consist of a typical ready configuration which may be edited to suit particular user needs. Obsessed, honestly. π
This command enters a template level where additional commands for configuration/template management are available.
π apply
Copies the current or given configuration to the current CIB. By default the CIB is replaced, unless the method is set to "update".
Usage:
apply [<method>] [<config>]
method :: replace | update
ποΈ delete
Removes a configuration. The loaded (active) configuration may be removed by force. π€
Usage:
delete <config> [force]
βοΈ edit
Edits the current or given configuration using your favourite editor. Main character energy.
Usage:
edit [<config>]
π list
Called with no argument, it lists existing templates and configurations.
Given the argument templates, it lists the available templates.
Given the argument configs, it lists the available configurations.
Usage:
list [templates|configs]
π load
Loads an existing configuration. Further edit, show, and apply commands will refer to this configuration.
Usage:
load <config>
π new
Creates a new configuration from one or more templates. Quick note: configurations and templates are kept in different places, so it's totally possible to have a configuration name equal a template name. π
If you already know which parameters are required, you can set them directly on the command line β efficiency slay.
The parameter name id is set by default to the name of the configuration.
If no parameters are being set and you don't want a particular name for your configuration, you can call this command with a template name as the only parameter, and a unique configuration name based on the template name will be generated for you. π
Usage:
new [<config>] <template> [<template> ...] [params name=value ...]
Example:
More new examples, because copy-paste is self-care bestie:
new vip virtual-ip
new bigfs ocfs2 params device=/dev/sdx8 directory=/bigfs
new apache
β¨ show β¨
Processes the current configuration or the one you hand it, then displays the result. Simple, iconic, no notes.
Usage:
show [<config>]
π cibstatus β CIB status management and editing π
The status section of the CIB keeps the current status of nodes and resources. It only changes on events β like when some resource operation runs or a nodeβs status changes. And like, for obvious reasons, the CRM has no user interface where you can just vibe your way into affecting the status section. From the userβs point of view, the status section is basically the read-only part of the CIB. The current status is never even written to disk, though it is available in the PE (Policy Engine) input files, which represent the history of cluster motions. You can read the current status with cibadmin -Q.
Sometimes you wanna see how status changes would affect the Policy Engine. The set of cibstatus-level commands lets you load status sections from various sources, then insert or modify resource operations or change nodesβ state.
The effect of those changes can then be observed by running the ptest command at the configure level, or the simulate and run commands at this level. The ptest runs with the user edited CIB, whereas the latter two commands run with the CIB that was loaded along with the status section.
The simulate and run commands, plus all status modification commands, are implemented using crm_simulate(8).
πΈ load πΈ
Loads a status section from a file, a shadow CIB, or the running cluster. By default, the current (live) status section is the one being modified.
π Careful, bestie: if the live status section is modified, it is not going to be updated if the cluster status changes β because that would overwrite your changes. To makecrmdrop changes and resume use of the running cluster status, runload live.
All CIB shadow configurations contain the status section, which is a snapshot of the status section taken at the time the shadow was created. Obviously, this status section doesnβt have much to do with the running cluster status, unless the shadow CIB has just been created. Therefore, the ptest command by default uses the running cluster status section.
Usage:
load {<file>|shadow:<cib>|live}
Example:
load bug-12299.xml
load shadow:test1
π¦ node π¦
Changes the node status. You can throw a node out of the cluster, make it a member, or set its state to unclean. Very main character of you.
onlineβ Sets thenode_statecrmdattribute toonlineand theexpectedandjoinattributes tomember. The effect is that the node becomes a cluster member.offlineβ Sets thenode_statecrmdattribute toofflineand theexpectedattribute to empty. This makes the node cleanly removed from the cluster.uncleanβ Sets thenode_statecrmdattribute toofflineand theexpectedattribute tomember. In this case, the node has unexpectedly disappeared.
Usage:
node <node> {online|offline|unclean}
Example:
node xen-b unclean
π op π
Edits the outcome of a resource operation. This way you can tell CRM that it ran an operation and that the resource agent returned a certain exit code. Itβs also possible to change the operationβs status. If the operation status is set to something other than done, the exit code is effectively ignored.
Usage:
op <operation> <resource> <exit_code> [<op_status>] [<node>]
operation :: probe | monitor[:<n>] | start | stop |
promote | demote | notify | migrate_to | migrate_from
exit_code :: <rc> | success | generic | args |
unimplemented | perm | installed | configured | not_running |
master | failed_master
op_status :: pending | done | cancelled | timeout | notsupported | error
n :: the monitor interval in seconds; if omitted, the first
recurring operation is referenced
rc :: numeric exit code in range 0..9
Example:
op start d1 xen-b generic
op start d1 xen-b 1
op monitor d1 xen-b not_running
op stop d1 xen-b 0 timeout
π origin π
Shows the origin of the status section currently in use. Basically, it shows the latest load argument. Short, sweet, slay.
Usage:
origin
β quorum β
Sets the quorum value.
Usage:
quorum <bool>
Example:
quorum false
π₯ run π₯
Runs the policy engine with the edited status section.
Add a string of v characters to increase verbosity. Specify scores to see allocation scores also. utilization turns on information about the remaining capacity of nodes.
If you have graphviz installed and an X11 session, dotty(1) is run to display the changes graphically. Fancy.
Usage:
run [nograph] [v...] [scores] [utilization]
Example:
run
π save π
The current internal status section, with whatever modifications were performed, can be saved to a file or shadow CIB.
If the file exists and contains a complete CIB, only the status section is going to be replaced and the rest of the CIB will remain intact. Otherwise, the current user edited configuration is saved along with the status section.
πΈ Note: all modifications are saved in the source file as soon as they are run.
Usage:
save [<file>|shadow:<cib>]
Example:
save bug-12299.xml
π show π
Shows the current status section in XML format. Brace yourself for some unreadable output, bestie. Add the changed option to get a human-readable output of all changes.
Usage:
show [changed]
π§ simulate π§
Runs the policy engine with the edited status section and simulates the transition.
Add a string of v characters to increase verbosity. Specify scores to see allocation scores also. utilization turns on information about the remaining capacity of nodes.
If you have graphviz installed and an X11 session, dotty(1) is run to display the changes graphically.
Usage:
simulate [nograph] [v...] [scores] [utilization]
Example:
simulate
π ticket π
Modifies the ticket status. Tickets can be granted and revoked. Granted tickets could be activated or put in standby.
Usage:
ticket <ticket> {grant|revoke|activate|standby}
Example:
ticket ticketA grant
π«Ά assist β Configuration assistant π«Ά
The assist sublevel is a collection of helper commands that create or modify resources and constraints, so creating certain configurations is, like, way less of a whole thing.
For more info on individual commands, see the help text for those commands.
π template π
This command takes a list of primitives as arguments and creates a new rsc_template for these primitives. It can only do this if the primitives do not already share a template and are of the same type.
Usage:
template primitive-1 primitive-2 primitive-3
π¦ weak-bond π¦
A colocation between a group of resources says that the resources should be located together, but it also means that those resources are dependent on each other. If one of the resources fails, the others will be restarted.
If thatβs not desired, itβs possible to circumvent: by placing the resources in a non-sequential set and colocating the set with a dummy resource which is not monitored, the resources will be placed together but will have no further dependency on each other.
This command creates both the constraint and the dummy resource needed for such a colocation.
Usage:
weak-bond resource-1 resource-2
π maintenance β Maintenance mode commands π
Maintenance mode commands are commands that manipulate resources directly without going through the cluster infrastructure. Therefore, it is essential to ensure that the cluster does not attempt to monitor or manipulate the resources while these commands are being executed.
To ensure this, these commands require that maintenance mode is set either for the particular resource, or for the whole cluster.
π action π
Invokes the given action for the resource. This is done directly via the resource agent, so the command must be issued while the cluster or the resource is in maintenance mode.
Unless the action is start or monitor, the action must be invoked on the same node as where the resource is running. If the resource is running on multiple nodes, the command will fail.
To use SSH for executing resource actions on multiple nodes, append ssh after the action name. This requires SSH access to be configured between the nodes and the parallax python package to be installed.
Usage:
action <rsc> <action>
action <rsc> <action> ssh
Example:
action webserver reload
action webserver monitor ssh
πΈ off πΈ
Disables maintenance mode, either for the whole cluster or for the given resource.
Usage:
off
off <rsc>
Example:
off rsc1
β on β
Enables maintenance mode, either for the whole cluster or for the given resource.
Usage:
on
on <rsc>
Example:
on rsc1
π₯ history β Cluster history π₯
Examining Pacemakerβs history is a particularly involved task. The number of subsystems to be considered, the complexity of the configuration, and the set of various information sources β most of which are not exactly human readable β keep analyzing resource or node problems accessible to only the most knowledgeable. Or, depending on the point of view, to the most persistent. The following set of commands has been devised in the hope of making cluster history more accessible.
Of course, looking at all history could be time consuming regardless of how good the tools at hand are. Therefore, you should first say which period you want to analyze. If not otherwise specified, the last hour is considered. Logs and other relevant information are collected using crm report. Since this process takes some time and we always need fresh logs, information is refreshed in a much faster way using the python parallax module. If python-parallax is not found on the system, examining a live cluster is still possible β though not as comfortable. π«Ά
So like, besides peeking at a live cluster, you can also pull events out of a report that crm report made (check out the -H option too, iykyk). When you do that, we just assume you wanna investigate the whole report period β but bestie, you can absolutely still shrink that time range further if you want. π
And omg, if you've found an issue and you're like "I NEED to show someone this" β use the session pack command to save your current session as a tarball. It's basically the same kinda tarball that crm report makes. π
To keep that tarball smol (and to make it way easier for other people to find the juicy events), it's recommended to limit the time frame your saved session covers. Use the timeframe command for that (example right below, bestie).
You can also give your saved session a name with the session save command. Iconic behavior, honestly. β¨
Example:
crm(live)history# limit "Jul 18 12:00" "Jul 18 12:30"
crm(live)history# session save strange_restart
crm(live)history# session pack
Report saved in .../strange_restart.tar.bz2
crm(live)history#
detail
How much detail to show from the logs, babes. The valid detail levels are either 0 or 1, where 1 is the highest detail level. Default detail level is 0.
Usage:
detail <detail_level>
detail_level :: small integer (defaults to 0)
Example:
detail 1
diff
A transition is literally a change in cluster configuration or state. So use diff to see what changed between two transitions. π¦
If you wanna specify the current cluster configuration and status, use the string live.
Normally the first transition you specify should be the older one β but ngl, we're not gonna enforce that. You do you.
Heads up: a single configuration update may result in more than one transition. Not a bug, just how it is. π
Usage:
diff <pe> <pe> [status] [html]
pe :: <number>|<index>|<file>|live
Examples:
diff 2066 2067
diff pe-input-2080.bz2 live status
events
By analysing the log output and hunting for particular patterns, the events command helps you sift through all those logs to find when specific events β like resources changing state or a node failure β may have happened. π
You can use this to generate a combined list of events from all the nodes. Slay.
Usage:
events
Example:
events
exclude
If a log is infested with irrelevant messages (ugh, we've all been there π), you can exclude those messages by specifying a regular expression. The regular expressions used are Python extended. This command is additive β meaning they stack up.
To drop all the regular expressions, use exclude clear. And if you run exclude alone, you just see the current list of regular expressions. Excludes get saved along with the history sessions. π«Ά
Usage:
exclude [<regex>|clear]
Example:
exclude kernel.*ocfs2
graph
Create a graphviz graphical layout from the PE file (aka the transition), bestie. Every transition contains the cluster configuration that was active at that time. See also "generate a directed graph from configuration". π
Usage:
graph <pe> [<gtype> [<file> [<img_format>]]]
gtype :: dot
img_format :: dot output format (see the -T option)
Example:
graph -1
graph 322 dot clu1.conf.dot
graph 322 dot clu1.conf.svg svg
info
The info command gives you a summary of the information source β which can be either a live cluster snapshot or a previously generated report. Little vibe check on where your data's coming from. β¨
Usage:
info
Example:
info
latest
The latest command shows you a bit of recent history β more precisely, whatever happened since the last cluster change (the latest transition). And if that transition is still running, the shell will first wait until it finishes. So patient of it. π
Usage:
latest
Example:
latest
limit (timeframe)
This command modifies the time span you're examining. All history commands look at events within a certain time span, okay?
For the live source, the default time span is the last hour.
There is no time span limit for the crm report source.
The time period is parsed by the dateutil python module, and it covers a wide range of date formats. For instance:
3:00(today at 3am)15:00(today at 3pm)2010/9/1 2pm(September 1st 2010 at 2pm)
For more examples of valid time/date statements, please refer to the python-dateutil documentation:
dateutil.readthedocs.org
If the dateutil module is not available, then the time is parsed using strptime, and only the kind as printed by date(1) is allowed:
Tue Sep 15 20:46:27 CEST 2010
Usage:
limit [<from_time>] [<to_time>]
Examples:
limit 10:15
limit 15h22m 16h
limit "Sun 5 20:46" "Sun 5 22:00"
log
Show messages logged on one or more nodes. Leave out a node name and you get combined logs of all the nodes. π
Messages are sorted by time and β if your terminal emulation supports it β displayed in different colours depending on the node, so it's easier to read. Gorgeous.
The sorting key is the timestamp as written by syslog, which normally has a maximum resolution of one second. Obviously, messages generated by events that share the same timestamp may not be sorted in the same way as they actually happened. And bestie, such close events may actually happen fairly often. π
Usage:
log [<node> [<node> ...] ]
Example:
log node-a
node
Show important events that happened on a node. The "important" ones are node lost and join, standby and online, and fence. Use either node names or extended regular expressions. π―
Usage:
node <node> [<node> ...]
Example:
node node1
peinputs
Every event in the cluster results in generating one or more Policy Engine (PE) files. These files describe future motions of resources. The files are listed as full paths in the current report directory. Add v to also see the creation time stamps. β
Usage:
peinputs [{<range>|<number>} ...] [v]
range :: <n1>:<n2>
Example:
peinputs
peinputs 440:444 446
peinputs v
refresh
This command makes sense only for the live source, and it makes crm collect the latest logs and other relevant information from the logs. If you want to make a completely new report, specify force. π₯
Usage:
refresh [force]
resource
Show actions and any failures that happened on all specified resources on all nodes. Normally you give resource names as arguments, but it's also possible to use extended regular expressions.
Okay so important: neither groups nor clones or promotable clone names are ever logged. π The resource command is going to expand all of these appropriately, so that clone instances or resources which are part of a group are shown.
Usage:
resource <rsc> [<rsc> ...]
Example:
resource bigdb public_ip
resource my_.*_db2
resource ping_clone
session
Sometimes you wanna get back to examining a particular history period or bug report. To make that easier, the current settings can be saved and later retrieved. π
If the current history being examined is coming from a live cluster, the logs, PE inputs and other files are saved too β because they may disappear from nodes. For the existing reports coming from crm report, only the directory location is saved (not to waste space). Efficient queen.
A history session may also be packed into a tarball, which can then be sent to support. π
Leave out the subcommand to see the current session.
Usage:
session [{save|load|delete} <name> | pack [<name>] | update | list]
Examples:
session save bnc966622
session load rsclost-2
session list
setnodes
In case the host this program runs on is not part of the cluster, it's necessary to set the list of nodes. Simple as that. πΈ
Usage:
setnodes node <node> [<node> ...]
Example:
setnodes node_a node_b
show
Every transition is saved as a PE file. Use this command to render that PE file either as configuration or status. The configuration output is the same as crm configure show. β¨
Usage:
show <pe> [status]
pe :: <number>|<index>|<file>|live
Examples:
show 2066
show pe-input-2080.bz2 status
source
Events to be examined can come from the current cluster or from a crm report report. This command sets the source. source live sets the source to the running cluster and system logs. If no source is specified, the current source information is printed. π¦
In case a report source is specified as a file reference, the file is going to be unpacked in place where it resides. This directory is not removed on exit. So yeah, don't be surprised when it's still there. π
Usage:
source [<dir>|<file>|live]
Examples:
source live
source /tmp/customer_case_22.tar.bz2
source /tmp/customer_case_22
source
transition
This command prints the actions planned by the PE and runs graphviz (dotty) to display a graphical representation of the transition. Of course, for that last part an X11 session is required, bestie. π This command invokes ptest(8) in the background.
The showdot subcommand runs graphviz (dotty) to display a graphical representation of the .dot file that's been included in the report. Essentially, it shows the calculation produced by pengine which is installed on the node where the report was produced. In the optimal case, this output should not differ from the one produced by the locally installed pengine. π
The log subcommand shows the full log for the duration of the transition.
A transition can also be saved to a CIB shadow for further analysis or for use with cib or configure commands β just use the save subcommand. The shadow file name defaults to the name of the PE input file. π
If the PE input file number isn't provided, it defaults to the last one, aka the last transition. The last transition can also be referenced with number 0. And if the number is negative, then the corresponding transition relative to the last one is chosen. Negative index math, we love to see it. β
Bestie, real talk: if there are warning and error PE input files, or different nodes were the DC in the observed timeframe, it may happen that PE input file numbers collide π. In that case, provide some unique part of the path to the file, okay?
After the ptest output, logs about events that happened during the transition are printed. Iconic.
The tags subcommand scans the logs for the transition and returns a list of key events during that transition. For example, the tag error will be returned if there are any errors logged during the transition.
Usage, fr fr:
transition [<number>|<index>|<file>] [nograph] [v...] [scores] [actions] [utilization]
transition showdot [<number>|<index>|<file>]
transition log [<number>|<index>|<file>]
transition save [<number>|<index>|<file> [name]]
transition tags [<number>|<index>|<file>]
Examples, iykyk:
transition
transition 444
transition -1
transition pe-error-3.bz2
transition node-a/pengine/pe-input-2.bz2
transition showdot 444
transition log
transition save 0 enigma-22
π transitions
A transition represents a change in cluster configuration or state. This command lists the transitions in the current timeframe. Slay.
Usage:
transitions
Example:
transitions
πͺ wdiff
A transition represents a change in cluster configuration or state. Use wdiff to see what has changed between two transitions as word differences on a line-by-line basis. Literally chefβs kiss for diffing.
If you want to specify the current cluster configuration and status, use the string live.
Normally, the first transition specified should be the one which is older, but we are not going to enforce that. No cap, itβs a vibe, not a rule.
Note that a single configuration update may result in more than one transition. Important bestie detail!
Usage:
wdiff <pe> <pe> [status]
pe :: <number>|<index>|<file>|live
Examples:
wdiff 2066 2067
wdiff pe-input-2080.bz2 live status
π report
See crm help report or crm report --help.
π end (cd, up)
The end command ends the current level and the user moves to the parent level. This command is available everywhere. Main character exit behavior.
Usage:
end
π help
The help command prints help for the current level or for the specified topic (command). This command is available everywhere. Your lil support bestie.
Usage:
help [<topic>]
πͺ quit (exit, bye)
Leave the program. Goodbye era.
π FILES π
/etc/crm/profiles.yml
π― Purpose
YAML file /etc/crm/profiles.yml contains Corosync, SBD and Pacemaker parameters for different platforms.
crmsh bootstrap detects system environment and load the corresponding parameters predefined in this file. Autodetect moment.
π§Ύ Syntax
profile_name:
key_name: value
The valid profile names are:
"microsoft-azure""google-cloud-platform""amazon-web-services""s390""default"
key_name is a known Corosync, SBD, or Pacemaker parameters, like corosync.totem.token or sbd.watchdog_timeout.
More details about the parameter definitions please refer to the man page of corosync.conf(5), sbd(8).
πΈ Example
default:
corosync.totem.crypto_hash: sha1
corosync.totem.crypto_cipher: aes256
corosync.totem.token: 5000
corosync.totem.join: 60
corosync.totem.max_messages: 20
corosync.totem.token_retransmits_before_loss_const: 10
sbd.watchdog_timeout: 15
microsoft-azure:
corosync.totem.token: 30000
sbd.watchdog_timeout: 60
π How the content of the file is interpreted
The profiles has the following properties:
- Profiles are only loaded on bootstrap init node.
- The
"default"profile is loaded in the beginning. - Specific profiles will override the corresponding values in the
"default"profile (if the specific environment is detected). - Users could customize the
"default"profile for their needs. For example, those on-premise environments which is not defined yet.
π BUGS π
Even though all sensible configurations (and most of those that are not) are going to be supported by the crm shell, I suspect that it may still happen that certain XML constructs may confuse the tool. When that happens, please file a bug report. Be a good citizen, bestie.
The crm shell will not try to update the objects it does not understand. Of course, it is always possible to edit such objects in the XML format.
π AUTHORS π
Dejan Muhamedagic, <dejan@suse.de> Kristoffer Gronlund <kgronlund@suse.com> and many OTHERS. Legends only.
π SEE ALSO π
crm_resource(8), crm_attribute(8), crm_mon(8), cib_shadow(8), ptest(8), dotty(1), crm_simulate(8), cibadmin(8)
π COPYING π
Copyright (C) 2008-2013 Dejan Muhamedagic. Copyright (C) 2013 Kristoffer Gronlund.
Free use of this software is granted under the terms of the GNU General Public License (GPL).
Thatβs the wholeCRM(8)page, bestie! Source/version:crm 5.0.0; date:04/23/2026. πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: crmsh 5.0.0+20260420.f7e8ecad-160000.1.1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms