Using crm

From Alteeve Wiki
Jump to navigation Jump to search

 AN!Wiki :: How To :: Using crm

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

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

new

Create a new shadow CIB.

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

delete

Delete a shadow CIB

usage: delete <shadow_cib>

reset

Copy live cib to a shadow CIB

usage: reset <shadow_cib>

commit

Copy a shadow CIB to the cluster

usage: commit <shadow_cib>

use

Change working CIB

diff

diff between the shadow CIB and the live CIB

list

list all shadow CIBs

import

import a CIB or PE input file to a shadow

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

cibstatus

CIB status management and editing

load

load the CIB status section

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

save

save the CIB status section

origin

display origin of the CIB status section

show

show CIB status section

This shows the raw XML.

node

change node status

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

op

edit outcome of a resource operation

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

quorum

set the quorum

usage: quorum <bool>

run

run policy engine

Also(?) displays the cluster status.

simulate

simulate cluster transition

Also(?) displays the cluster status.

resource

Resources management

status

show status of resources

start

start a resource

usage: start <rsc>

stop

stop a resource

usage: stop <rsc>

restart

restart a resource

usage: restart <rsc>

promote

promote a master-slave resource

usage: promote <rsc>

demote

demote a master-slave resource

usage: demote <rsc>

manage

put a resource into managed mode

usage: manage <rsc>

unmanage

put a resource into unmanaged mode

usage: unmanage <rsc>

migrate

migrate a resource to another node

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

unmigrate

unmigrate a resource to another node

usage: unmigrate <rsc>

param

manage a parameter of a resource

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

meta

manage a meta attribute

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

utilization

manage a utilization attribute

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

failcount

manage failcounts

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

cleanup

cleanup resource status

usage: cleanup <rsc> [<node>]

refresh

refresh CIB from the LRM status

reprobe

probe for resources not started by the CRM

configure

CRM cluster configuration

node

define a cluster node

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

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>...] ...]]

monitor

add monitor operation to a primitive

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

group

define a group

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

clone

define a clone

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

ms

define a master-slave resource

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

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

colocation

colocate resources

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

order

order resources

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

property

set a cluster property

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

rsc_defaults

set resource defaults

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

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

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.)

op_defaults

set resource operations defaults

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

show

display CIB objects

Shows the current cluster configuration.

edit

edit CIB objects

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

filter

filter CIB objects

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

delete

delete CIB objects

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

default-timeouts

set timeouts for operations to minimums from the meta-data

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

rename

rename a CIB object

usage: rename <old_id> <new_id>

refresh

refresh from CIB

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

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.

ptest

show cluster actions if changes were committed

INFO: install graphviz to see a transition graph

cib

Same menu as #cib off the root of the shell.

cibstatus

Same menu as #cib > cibstatus off the root of the shell.

template

edit and import a configuration from a template

commit

commit the changes to the CIB

verify

verify the CIB with crm_verify

upgrade

upgrade the CIB to version 1.0

save

save the CIB to a file

load

import the CIB from a file

xml

raw xml

node

Nodes management

options

User preferences

ra

Resource agents information center

status

Show cluster status

 

Any questions, feedback, advice, complaints or meanderings are welcome.
Alteeve's Niche! Enterprise Support:
Alteeve Support
Community Support
© Alteeve's Niche! Inc. 1997-2024   Anvil! "Intelligent Availability®" Platform
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.