Using crm

From AN!Wiki
Jump to: navigation, search

 AN!Wiki :: How To :: Using crm

This aims to be a complete guide to using Pacemaker's crm cluster resource manager tool.

Contents

crm

The crm command is the main method of invoking the cluster resource manager.

  • Called without arguments, it invokes the crm shell.
  • Called with arguments, it acts as a "one-shot" operation, executing all commands following it.
  • Called with crm -f /path/to/file, it will read the file and execute all commands found within.
  • Called with crm -, STDIN is read for arguments.

The crm Shell

The crm shell acts as an interactive shell, allowing for the cluster to be manipulated in real-time.

All commands can be entered in a hierarchical manner. Simply enter a command and press <enter> to decent into that sub-command's menu. To return, type end, cd or up.

At any level, you can type help to get a list of arguments that are valid at the given level you are in.

At any time, you can type quit, bye or exit to leave the shell.

All commands listed in the rest of this document can be entered at the command line as a "one-shot" command. Likewise, a combination of command sequences can be saved in a file and the read into crm.

cib

Manage shadow CIBs

cib > new

Create a new shadow CIB.

usage: new <shadow_cib> [withstatus] [force] [empty]

Example; Create a shadow CIB called stonith:

cib new stonith
INFO: stonith shadow CIB created

cib > delete

Delete a shadow CIB

usage: delete <shadow_cib>

Example; Delete a shadow CIB called stonith.

cib delete stonith
INFO: stonith shadow CIB deleted

cib > reset

Copy live cib to a shadow CIB

usage: reset <shadow_cib>

cib > commit

Copy a shadow CIB to the cluster

usage: commit <shadow_cib>

cib > use

Change working CIB

cib > diff

diff between the shadow CIB and the live CIB

cib > list

list all shadow CIBs

cib > import

import a CIB or PE input file to a shadow

usage: import {<file>|<number>} [<shadow>]

cib > cibstatus

CIB status management and editing

cib > cibstatus > load

load the CIB status section

usage: load {<file>|shadow:<cib>|live}

cib > cibstatus > save

save the CIB status section

cib > cibstatus > origin

display origin of the CIB status section

cib > cibstatus > show

show CIB status section

This shows the raw XML.

cib > cibstatus > node

change node status

usage: node <node> {online|offline|unclean}

cib > cibstatus > op

edit outcome of a resource operation

usage: op <operation> <resource> <exit_code> [<op_status>] [<node>]

cib > cibstatus > quorum

set the quorum

usage: quorum <bool>

cib > cibstatus > run

run policy engine

Also(?) displays the cluster status.

cib > cibstatus > simulate

simulate cluster transition

Also(?) displays the cluster status.

resource

Resources management

resource > status

show status of resources

resource > start

start a resource

usage: start <rsc>

resource > stop

stop a resource

usage: stop <rsc>

resource > restart

restart a resource

usage: restart <rsc>

resource > promote

promote a master-slave resource

usage: promote <rsc>

resource > demote

demote a master-slave resource

usage: demote <rsc>

resource > manage

put a resource into managed mode

usage: manage <rsc>

resource > unmanage

put a resource into unmanaged mode

usage: unmanage <rsc>

resource > migrate

migrate a resource to another node

usage: migrate <rsc> [<node>] [<lifetime>] [force]

resource > unmigrate

unmigrate a resource to another node

usage: unmigrate <rsc>

resource > param

manage a parameter of a resource

usage:
        param <rsc> set <param> <value>
        param <rsc> delete <param>
        param <rsc> show <param>

resource > meta

manage a meta attribute

usage:
        meta <rsc> set <attr> <value>
        meta <rsc> delete <attr>
        meta <rsc> show <attr>

resource > utilization

manage a utilization attribute

usage:
        utilization <rsc> set <attr> <value>
        utilization <rsc> delete <attr>
        utilization <rsc> show <attr>

resource > failcount

manage failcounts

usage:
        failcount <rsc> set <node> <value>
        failcount <rsc> delete <node>
        failcount <rsc> show <node>

resource > cleanup

cleanup resource status

usage: cleanup <rsc> [<node>]

resource > refresh

refresh CIB from the LRM status

resource > reprobe

probe for resources not started by the CRM

configure

CRM cluster configuration

configure > node

define a cluster node

usage: node <uname>[:<type>]
           [attributes <param>=<value> [<param>=<value>...]]
           [utilization <param>=<value> [<param>=<value>...]]

configure > primitive

define a resource

usage: primitive <rsc> [<class>:[<provider>:]]<type>
        [params <param>=<value> [<param>=<value>...]]
        [meta <attribute>=<value> [<attribute>=<value>...]]
        [utilization <attribute>=<value> [<attribute>=<value>...]]
        [operations id_spec
            [op op_type [<attribute>=<value>...] ...]]

configure > monitor

add monitor operation to a primitive

usage: monitor <rsc>[:<role>] <interval>[:<timeout>]

configure > group

define a group

usage: group <name> <rsc> [<rsc>...]
        [params <param>=<value> [<param>=<value>...]]
        [meta <attribute>=<value> [<attribute>=<value>...]]

configure > clone

define a clone

usage: clone <name> <rsc>
        [params <param>=<value> [<param>=<value>...]]
        [meta <attribute>=<value> [<attribute>=<value>...]]

configure > ms

define a master-slave resource

usage: ms <name> <rsc>
        [params <param>=<value> [<param>=<value>...]]
        [meta <attribute>=<value> [<attribute>=<value>...]]

configure > location

a location preference

usage: location <id> <rsc> {node_pref|rules}
 
        node_pref :: <score>: <node>
 
        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

configure > colocation

colocate resources

usage: colocation <id> <score>: <rsc>[:<role>] <rsc>[:<role>]

configure > order

order resources

usage: order <id> score-type: <first-rsc>[:<action>] <then-rsc>[:<action>]
        [symmetrical=<bool>]

configure > property

set a cluster property

usage: property [$id=<set_id>] <option>=<value>

configure > rsc_defaults

set resource defaults

usage: rsc_defaults [$id=<set_id>] <option>=<value>

configure > role

define role access rights

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

configure > user

define user access rights

user <uid> {roles|rules}
 
        roles :: role:<role-ref> [role:<role-ref> ...]
        rules :: rule [rule ...]
 
        (See the role command for details on rules.)

configure > op_defaults

set resource operations defaults

usage: op_defaults [$id=<set_id>] <option>=<value>

configure > show

display CIB objects

Shows the current cluster configuration.

configure > edit

edit CIB objects

This opens an editor (vim?) with the current CIB objects.

configure > filter

filter CIB objects

usage: filter <prog> [xml] [<id>...]

configure > delete

delete CIB objects

usage: delete <id> [<id>...]

configure > default-timeouts

set timeouts for operations to minimums from the meta-data

usage: default-timeouts <id> [<id>...]

configure > rename

rename a CIB object

usage: rename <old_id> <new_id>

configure > refresh

refresh from CIB

This will reload the old CIB, causing any uncommitted changes to be lost.

configure > erase

erase the CIB

This wipes out all CIB objects, leaving only the bare node definitions. If used accidentally, use refresh to restore the current CIB configuration.

configure > ptest

show cluster actions if changes were committed

INFO: install graphviz to see a transition graph

configure > cib

Same menu as cib off the root of the shell.

configure > cibstatus

Same menu as cib > cibstatus.

configure > template

edit and import a configuration from a template

configure > template > new

create a new configuration from templates

usage: new <config> <template> [<template> ...] [params name=value ...]

configure > template > load

load a configuration

configure > template > edit

edit a configuration

configure > template > delete

delete a configuration

usage: delete <config> [force]

configure > template > list

list configurations/templates

configure > template > apply

process and apply the current configuration to the current CIB

configure > template > show

show the processed configuration

configure > commit

commit the changes to the CIB

configure > verify

verify the CIB with crm_verify

configure > upgrade

upgrade the CIB to version 1.0

configure > save

save the CIB to a file

usage: save [xml] <filename>

configure > load

import the CIB from a file

usage: load [xml] {replace|update} {<url>|<path>}

configure > xml

raw xml

usage: xml <xml>

node

Nodes management

node > status

show nodes' status

  • Prints the current node status as XML.

Example:

<nodes>
  <node id="an-node02.alteeve.com" type="normal" uname="an-node02.alteeve.com"/>
  <node id="an-node01.alteeve.com" type="normal" uname="an-node01.alteeve.com"/>
</nodes>

node > show

show node

  • Prints the current node status as plain text.

Example:

an-node02.alteeve.com: normal
an-node01.alteeve.com: normal

node > standby

put node into standby

node > online

set node online

node > fence

fence node

usage: fence <node>

node > clearstate

Clear node state

usage: clearstate <node>

node > delete

delete node

usage: delete <node>

node > attribute

manage attributes

usage:
        attribute <node> set <rsc> <value>
        attribute <node> delete <rsc>
        attribute <node> show <rsc>

node > utilization

manage utilization attributes

usage:
        utilization <node> set <rsc> <value>
        utilization <node> delete <rsc>
        utilization <node> show <rsc>

node > status-attr

manage status attributes

usage:
        status-attr <node> set <rsc> <value>
        status-attr <node> delete <rsc>
        status-attr <node> show <rsc>

options

User preferences

options > skill-level

set skill level

usage: skill-level <level>
        level: operator | administrator | expert

options > user

set the cluster user

options > editor

set preferred editor program

usage: editor <program>

options > pager

set preferred pager program

usage: pager <program>

options > sort-elements

sort CIB elements

usage: sort-elements {yes|no}

options > output

set output type

usage: output <type>

options > colorscheme

set colors for output

usage: colorscheme <colors>

options > check-frequency

when to perform semantic check

usage: check-frequence <freq>

options > check-mode

how to treat semantic errors

usage: check-mode <mode>

options > show

show current user preference

Example:

editor "vim"
pager "less"
user ""
skill-level "expert"
output "color"
colorscheme "yellow,normal,cyan,red,green,magenta"
sort-elements "yes"
check-frequency "always"
check-mode "strict"

options > save

save the user preferences to the rc file

ra

Resource agents information center

ra > classes

list classes and providers

Example:

heartbeat
lsb
ocf / heartbeat linbit pacemaker redhat
stonith

ra > list

list RA for a class (and provider)

usage: list <class> [<provider>]

ra > meta

show meta data for a RA

usage: meta [<class>:[<provider>:]]<type>

ra > providers

show providers for a RA and a class

usage: providers <ra> [<class>]

status

Show cluster status

Example:

============
Last updated: Sun Jul 10 20:56:49 2011
Stack: openais
Current DC: an-node01.alteeve.com - partition WITHOUT quorum
Version: 1.1.5-5.el6-01e86afaaa6d4a8c4836f68df80ababd6ca3902f
2 Nodes configured, 2 expected votes
1 Resources configured.
============
 
Online: [ an-node01.alteeve.com ]
OFFLINE: [ an-node02.alteeve.com ]

quit, bye, exit

...

help

...

end, cd, up

...

 

Any questions, feedback, advice, complaints or meanderings are welcome.
Us: Alteeve's Niche! Support: Mailing List IRC: #clusterlabs on Freenode   © Alteeve's Niche! Inc. 1997-2019
legal stuff: All info is provided "As-Is". Do not use anything here unless you are willing and able to take responsibility for your own actions.
Personal tools
Namespaces

Variants
Actions
Navigation
projects
Toolbox