找回密码
 注册
查看: 6|回复: 2

crm command 编辑文件 shell

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2023-12-22 11:39:28 | 显示全部楼层 |阅读模式
CRM shell / text based' ]4 C- x% b! N) k3 {" u9 _; x
The crm shell provides an "edit" function which will invoke the editor (default VI) with the current cib and allow for modification of any values inside the cib and once saved, will apply to the live cluster configuration.  This will trigger a one time probe of the modified resource to pick up any changes that were made to the primitive.
* Y$ y  V' m3 V1 g: R5 a) v( u# crm configure edit1 f( {! z8 E2 x( n* m. C
You may choose to edit the entire cib (all objects) or a set of objects.  To bring up a single primitive in the editor, use the following command.  
9 ^0 ?" K. y3 _7 J- m) \# crm configure edit <primitive name>
9 @9 C& S4 S+ }0 b+ J: vYou may also choose to edit the xml version of the cib.1 f2 X) B+ w/ Z7 Z' f0 K. X/ Q
# crm configure edit xml
* z* m$ L& d" E9 T; |: x4 iAs you save your edits,  crm shell will run a quick syntax check (crm configure verify)  and prompt if it detects any errors and allow you to make edits before committing.  & i2 G% x- {3 \8 d1 N/ g
Additional Information
6 W+ S, G+ R& G! n+ t$ m( e( LA quick text backup can be taken of your cluster configuration using the following command.
3 ~& k" q1 D. d! |% ^4 ~6 o# crm configure show > /root/cib_backup.txt, S1 x" A, q  ^. _
To restore a cib from a backup file previously created.
7 a: }) n8 ^. ^4 L8 _# crm configure load replace /root/cib_backup.txt

& e0 P# s8 V- T! U: t6 Z- e

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2023-12-22 11:40:10 | 显示全部楼层
To output the usage of crm and its command line options:
* Q1 z" M4 e: J* _, I" s4 L* y3 c) |
crm --help7 c: m) ~1 p" K  P: B3 t5 N( w
COPY
/ O2 F7 A7 F0 y( m! DTo give a list of all available commands:
7 X8 Z& ~2 g+ k" F; \% R9 O
. k5 A5 c* _1 a% gcrm help
' C( a2 B, e8 p! [: `: G/ gCOPY$ F) `. u0 d& U
To access other help sections, not just the command reference:
) i" F  f' L& }4 D/ z
$ B% m, X9 }0 r$ ?! D3 m( ucrm help topics1 W2 G- L" X% D  |( L) j
COPY
# X$ O# {# {3 {5 g4 C/ DTo view the extensive help text of the configure subcommand:1 K( f8 ^, W5 x* _+ D
# x9 x$ A9 Q8 }6 j4 M
crm configure help* N/ T8 y6 `9 d; @5 Z8 H5 E
COPY
3 C7 H, k, V; g: {& \- CTo print the syntax, its usage, and examples of the group subcommand of configure:. u; B( @" {$ }) g1 D. l

9 n5 f6 j" k; i% m# w: G4 mcrm configure help group( X& X  W+ m! l0 N# W) x* w
COPY
, D* ~2 O* S" q  [& Z8 n6 ]This is the same:9 e* h7 F; j& C1 m

. A4 U& \' V: v; C- |; I% Rcrm help configure group
% C/ x3 O, l9 _; |* A) KCOPY

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2023-12-22 11:54:34 | 显示全部楼层
crm options user hacluster
7 @1 b/ z$ s' d  t( l9 W* a& X. ICOPY9 B" G5 d' h1 ]" m
Note that you need to set up /etc/sudoers so that sudo does not ask for a password./ ]0 Y" x  J' Q! |
" i  m1 g2 y7 S6 g9 P8 l
7.1 crmsh—Overview
' x0 q+ q: C" ^* R. Z* y+ I0 {# _# ^. \) t7 g( A# T) w) S
The crm command has several subcommands which manage resources, CIBs, nodes, resource agents, and others. It offers a thorough help system with embedded examples. All examples follow a naming convention described in Appendix B.
6 q/ r9 F2 P, M8 |  h
, H+ |; {* Q& [1 p2 o+ `! L( nTipTip: Interactive crm Prompt/ e$ i' K2 h7 C3 o2 l
By using crm without arguments (or with only one sublevel as argument), the crm shell enters the interactive mode. This mode is indicated by the following prompt:
' m! ?+ P7 k0 ~, g2 f! B$ w; X4 m
' q: L* h2 N  [+ {3 K/ I& F4 [1 wCOPY
4 F& r4 j# u3 U- aFor readability reasons, we omit the host name in the interactive crm prompts in our documentation. We only include the host name if you need to run the interactive shell on a specific node, like alice for example:
& F% k0 |, Q7 X) L' \
7 s# o8 j& q. s3 Q3 ]2 u1 [* _COPY
3 z1 m9 z/ B/ U: M# u7.1.1 Getting Help3 ?" e* d4 R- x, N) _' N) [# w

6 |( z3 v% b- K) mHelp can be accessed in several ways:9 T1 F& c) f: D0 v
) R% u. X+ @: d0 ~
To output the usage of crm and its command line options:
, Z) a; V  J# g5 R/ W& p4 C# y+ D) s  G2 W
crm --help6 @5 B" x, e: _
COPY# K# F, f5 P! q* y! X, K
To give a list of all available commands:
0 S) j0 m$ l  s& v) E2 G& o" y, _  v* @
crm help8 c: A1 Z7 J! {0 e4 v, s0 W
COPY
( b+ C7 N& |# E/ J, F) R# YTo access other help sections, not just the command reference:+ Z6 Z- h( G' Q% `9 U3 M8 u
' @" k5 b3 Y  d/ F) }4 R
crm help topics
' @; T  L  p( V6 q2 cCOPY6 M% x; A, @2 Q: X3 Q) V
To view the extensive help text of the configure subcommand:5 M0 j, n/ Y; i

) M/ i8 Z) l7 ~3 Mcrm configure help
, h% {% W3 k" mCOPY, U' E( B; L" @7 d6 ^/ w1 r
To print the syntax, its usage, and examples of the group subcommand of configure:/ f, l( }9 F1 @! J9 _9 h# Q

4 G9 ~) n$ R) z2 p8 G, \crm configure help group0 m: ?" Q+ U/ e2 q, n
COPY
- W, z- ~2 O) {2 [* D& J  D0 zThis is the same:
+ H- `9 B5 n6 I+ {$ D. f" N+ V) \# i: w* `) L. u' I$ e9 `
crm help configure group
! s  f+ J/ Z( ?) z* Q" LCOPY6 y( i! {6 x8 E
Almost all output of the help subcommand (do not mix it up with the --help option) opens a text viewer. This text viewer allows you to scroll up or down and read the help text more comfortably. To leave the text viewer, press the Q key.4 p+ B9 \" A* F4 t7 ~- u: @2 j9 H
+ d4 E/ i/ k, D1 B- ^. \
TipTip: Use Tab Completion in Bash and Interactive Shell
! j6 q' x# X) X8 bThe crmsh supports full tab completion in Bash directly, not only for the interactive shell. For example, typing crm help config→| will complete the word like in the interactive shell.
$ g' |8 C% ~( u+ u
; ^# h/ q  y/ n8 w7.1.2 Executing crmsh's Subcommands
  b0 N* ], G1 p+ W6 U# h7 \% I4 e) P
- u3 E9 j& p2 M* F3 aThe crm command itself can be used in the following ways:
7 X# I- d$ [% R
) p$ g* i1 Q$ v" f3 U( cDirectly: Concatenate all subcommands to crm, press Enter and you see the output immediately. For example, enter crm help ra to get information about the ra subcommand (resource agents).
# z2 B7 }% ~$ r6 _- D; ]
2 b. F1 [5 M0 i# z7 X! l* DIt is possible to abbreviate subcommands as long as they are unique. For example, you can shorten status as st and crmsh will know what you have meant.
4 Q! u; @4 t" W& L- }! T% _; X4 W
Another feature is to shorten parameters. Usually, you add parameters through the params keyword. You can leave out the params section if it is the first and only section. For example, this line:
9 w: x8 o4 L* Z- i$ Q7 q% q7 p
: H# m. C* |$ X6 C6 z( t0 Bcrm primitive ipaddr IPaddr2 params ip=192.168.0.559 l6 L) c! z% x1 @
COPY/ N2 y9 f" Z* r8 u7 {: p: c* O2 L
is equivalent to this line:, w, l% r! `+ O6 N+ U3 D( _
( ~4 c( d! v+ e: F( ]7 H" ~" T
crm primitive ipaddr IPaddr2 ip=192.168.0.55
, e: x. I# L7 X0 J* gCOPY  U4 N; x' ~2 I  t8 q0 i5 K# [# N
As crm Shell Script: Crm shell scripts contain subcommands of crm. For more information, see Section 7.1.4, “Using crmsh's Shell Scripts”.% o2 f& I' f/ h* G) `1 p
, ]* k4 X- k! y9 t
As crmsh Cluster Scripts:These are a collection of metadata, references to RPM packages, configuration files, and crmsh subcommands bundled under a single, yet descriptive name. They are managed through the crm script command.+ k2 ?, M" y6 S' D6 \
7 [/ g( b5 Z% H, a
Do not confuse them with crmsh shell scripts: although both share some common objectives, the crm shell scripts only contain subcommands whereas cluster scripts incorporate much more than a simple enumeration of commands. For more information, see Section 7.1.5, “Using crmsh's Cluster Scripts”.
7 q  S# i- g, R. z* c6 H; ^% Q  J8 v# @6 v7 k2 T* N  o0 t2 T
Interactive as Internal Shell: Type crm to enter the internal shell. The prompt changes to crm(live). With help you can get an overview of the available subcommands. As the internal shell has different levels of subcommands, you can “enter” one by typing this subcommand and press Enter.3 k% ~, g" `* z# P# @1 V" M' v% J
# S' K! A. f# S& F- m3 g, S
For example, if you type resource you enter the resource management level. Your prompt changes to crm(live)resource#. If you want to leave the internal shell, use the commands quit, bye, or exit. If you need to go one level back, use back, up, end, or cd.2 y4 T  Y! l  T: V2 Z; c
5 X! {* g9 s2 ~$ b+ y% ~/ R4 A0 ?" S
You can enter the level directly by typing crm and the respective subcommand(s) without any options and press Enter.
) ?8 }$ }' H; a5 P
" y8 e0 E0 @* M5 G3 oThe internal shell supports also tab completion for subcommands and resources. Type the beginning of a command, press →| and crm completes the respective object./ ?1 y$ w: I3 T2 n+ E
) K& T3 M- [: b. M, y
In addition to previously explained methods, crmsh also supports synchronous command execution. Use the -w option to activate it. If you have started crm without -w, you can enable it later with the user preference's wait set to yes (options wait yes). If this option is enabled, crm waits until the transition is finished. Whenever a transaction is started, dots are printed to indicate progress. Synchronous command execution is only applicable for commands like resource start.
. ?9 h* |/ Z( ^# A" l% }# H7 U6 c' ~, N  H8 e1 Y
NoteNote: Differentiate Between Management and Configuration Subcommands
0 d7 }$ f1 W4 W! g) J- Y2 W( n4 T  P- RThe crm tool has management capability (the subcommands resource and node) and can be used for configuration (cib, configure).4 a! q2 p" v) f# m3 s2 t
- U4 B$ Q% a2 w( |/ t& |2 g
The following subsections give you an overview of some important aspects of the crm tool.! `" l6 ?4 F6 Y5 f

' N5 D& _5 F0 Q, G  A  n6 N7.1.3 Displaying Information about OCF Resource Agents( T& Q: T8 ~' V5 p2 ^/ M! A9 N; {: N

- s; a- u' l( s" R: t% W$ AAs you need to deal with resource agents in your cluster configuration all the time, the crm tool contains the ra command. Use it to show information about resource agents and to manage them (for additional information, see also Section 5.3.2, “Supported Resource Agent Classes”):5 e" ^* I" M7 Q, x, I6 @

0 O( S8 G  Q: {& E. qcrm ra
* z" T2 ?% h& [- t) I9 D6 mCOPY
" h' C  Q, U; |* W: X0 i, lThe command classes lists all classes and providers:
2 T& w% F# s" q' ^0 K" ^
: c# g& A# d4 D8 M$ _0 i1 |$ Zclasses
& d+ V9 t' a7 E  t8 j4 J- D lsb* G$ \% }; S, V$ M, D1 p% y
ocf / heartbeat linbit lvm2 ocfs2 pacemaker
4 o0 f; w1 {2 j service
: g% ~5 V) m/ }( D4 Y& S stonith2 W$ q; A2 p: o) T
systemd8 Q- F) n; B& K+ @
COPY1 t# X, M8 Z% d" w+ L2 o6 {; R
To get an overview of all available resource agents for a class (and provider) use the list command:
$ Z3 h- ^1 y2 U1 x
, A  F+ G* N7 I# x  J& Llist ocf: O& L8 o) _: Q& ?9 p. t7 V
AoEtarget           AudibleAlarm        CTDB                ClusterMon$ g& a- e* V" f/ c3 M
Delay               Dummy               EvmsSCC             Evmsd
# V# q) W! C, J( k. t( ]Filesystem          HealthCPU           HealthSMART         ICP/ s! o7 ^% D7 d  V
IPaddr              IPaddr2             IPsrcaddr           IPv6addr
( a1 \( ~0 p# ?" I7 U2 l# j' DLVM                 LinuxSCSI           MailTo              ManageRAID
0 m7 Z: P7 [9 b+ sManageVE            Pure-FTPd           Raid1               Route" w6 q- v- d# V2 \- ~
SAPDatabase         SAPInstance         SendArp             ServeRAID; r( S8 q. V7 o7 E1 G! A. h+ }
...
& v& c4 G; @0 l+ J- j. F, ~; C2 NCOPY" S: p1 |8 K4 a+ D  C' }
An overview of a resource agent can be viewed with info:1 q8 f9 `$ v, H5 w: X! \

' t: N2 E9 O& P% |9 binfo ocf:linbit:drbd0 E/ P2 }8 f# m1 g1 ?3 D% ?
This resource agent manages a DRBD* resource
8 i3 [0 B3 R2 x* Y1 U" \as a master/slave resource. DRBD is a shared-nothing replicated storage
  X# t% k  j/ Ydevice. (ocf:linbit:drbd)/ O+ s" ^0 D% x

( V# {# r4 p6 q1 H6 V$ l' oMaster/Slave OCF Resource Agent for DRBD9 ~% b" K- m$ k- o4 S2 j

- k7 S6 L$ ~4 v. d+ Q9 _  SParameters (* denotes required, [] the default):
0 d" N! y9 i7 H  D; F$ k# I/ ]3 z- h, Z$ H# Z
drbd_resource* (string): drbd resource name
  t7 f8 g; z* ^, K    The name of the drbd resource from the drbd.conf file.
, Q1 b* h( j7 n2 j, t- I" V( J* L8 }2 f. \. s
drbdconf (string, [/etc/drbd.conf]): Path to drbd.conf
' g9 I% c5 O) E4 `* c/ @1 M8 L" W" A    Full path to the drbd.conf file.* u6 r2 |3 ?$ c/ P7 p# L
8 ^1 @( a. d1 G9 M
Operations' defaults (advisory minimum):
; F5 f' {; c0 Y% |  z6 ?
& W$ W$ M. U/ K    start         timeout=240: y0 j- j9 Y2 Y# x% l( g7 R
    promote       timeout=908 Z" W" B# t6 h" Z  T8 e8 @
    demote        timeout=90
. e6 ^5 P6 w0 c5 z7 a( E    notify        timeout=90
1 C* K, q- ^" d4 N    stop          timeout=100
+ \" U' I0 Y8 @9 y    monitor_Slave_0 interval=20 timeout=20 start-delay=1m
7 r3 H: {4 L& [. o+ ^& Y    monitor_Master_0 interval=10 timeout=20 start-delay=1m, C1 u, M: L( T+ g
COPY/ F  O/ n3 W& ~
Leave the viewer by pressing Q.8 w% Q) q' Q4 Z! H% C, k

, ?/ F- D" _5 W0 A0 E5 P( }7 kTipTip: Use crm Directly& F: {! C! R- O
In the former example we used the internal shell of the crm command. However, you do not necessarily need to use it. You get the same results if you add the respective subcommands to crm. For example, you can list all the OCF resource agents by entering crm ra list ocf in your shell.5 X& Z7 v! w# P- r( I

" ?# V$ }- |1 S- f6 J( q+ C7.1.4 Using crmsh's Shell Scripts
* F4 p8 U5 d/ W8 r& u& q3 i
. }  |, G9 Z" M. ]8 _The crmsh shell scripts provide a convenient way to enumerate crmsh subcommands into a file. This makes it easy to comment specific lines or to replay them later. Keep in mind that a crmsh shell script can contain only crmsh subcommands. Any other commands are not allowed.
: Y+ Q+ q. t8 \( f/ D) [
" v3 P& A; Z2 {( ~Before you can use a crmsh shell script, create a file with specific commands. For example, the following file prints the status of the cluster and gives a list of all nodes:
* E8 }( m6 K7 d6 e5 c5 }
- Q- E) C8 d" _* IEXAMPLE 7.1: A SIMPLE CRMSH SHELL SCRIPT9 s6 N3 L, B& [" p, s4 `

7 S3 R& h* v" D8 {* }4 c0 S) z* f# A small example file with some crm subcommands
& L0 y# J; K  hstatus
. R8 j# {; @6 P5 _& L+ T" A& Vnode list2 V, g5 n6 N- s8 e
COPY2 `8 E; V4 ^3 v, u
Any line starting with the hash symbol (#) is a comment and is ignored. If a line is too long, insert a backslash (\) at the end and continue in the next line. It is recommended to indent lines that belong to a certain subcommand to improve readability.1 S1 Z2 i6 |+ r
7 o, v5 R/ @4 o+ Y0 L. r6 {: N) s
To use this script, use one of the following methods:! z& j$ t% I" s% F5 b  \  X! i

$ X5 y( g9 u; w( f0 w! A  G% `8 A6 G$ icrm -f example.cli# f! i, ~7 A7 B/ y4 g. X6 Z
crm < example.cli& L: g" n# r& D0 O# E+ K# u
COPY
9 }- U. t' c2 b- u, u- i7.1.5 Using crmsh's Cluster Scripts2 U0 K( N4 F1 L, Z& g5 a4 f
' ~8 C& _. ]0 }
Collecting information from all cluster nodes and deploying any changes is a key cluster administration task. Instead of performing the same procedures manually on different nodes (which is error-prone), you can use the crmsh cluster scripts.
$ X( y) c. C/ t" [! O& Y" w* w) H0 A0 P' K- q7 @
Do not confuse them with the crmsh shell scripts, which are explained in Section 7.1.4, “Using crmsh's Shell Scripts”.
# k+ m) x: Y* X$ |+ A& I3 Y0 Z: T& t3 T- g2 a3 m
In contrast to crmsh shell scripts, cluster scripts performs additional tasks like:
! C. |' }2 C- [/ k4 G7 n$ w0 S% c$ t( X# U5 _- s6 S% ~% k
Installing software that is required for a specific task.
* L0 O4 E% S4 N8 J, l
2 `3 ~' K2 O( e5 nCreating or modifying any configuration files.
6 k4 B% J; i# ^7 G0 w" i7 _
: ]5 f; ~* T/ `/ kCollecting information and reporting potential problems with the cluster.
  ]" E- j7 G% R1 T7 S* S* L4 X$ E* O; r
Deploying the changes to all nodes.
" T9 @( ^  I& U9 _& H/ b
  ~0 r/ ~' v" J) A! p# Ncrmsh cluster scripts do not replace other tools for managing clusters—they provide an integrated way to perform the above tasks across the cluster. Find detailed information at http://crmsh.github.io/scripts/.
" h- c7 `, B* T% {& f+ d+ W5 X
$ i3 Z# E& @4 @0 I! L! H7.1.5.1 Usage
' q6 P& ^* W, X+ q. [3 z$ D$ A4 n/ K0 _# Z$ h; p  ?7 \
To get a list of all available cluster scripts, run:
7 b; D: c6 V2 o7 H, _
6 v' [# }% o0 t  S7 U: hcrm script list
1 ^% E& {& D! q/ [$ S0 bCOPY
$ Q& u% f) Z; ITo view the components of a script, use the show command and the name of the cluster script, for example:% V% K8 P' B+ Z* P7 s( B( U

3 d- ?4 I% ^( L' ^crm script show mailto
+ x8 Y% R4 C- |( ~# H& }mailto (Basic)
8 |; E5 Y6 J. CMailTo: ~$ z, v5 T( q
+ x* \' W; E% k! Y
This is a resource agent for MailTo. It sends email to a sysadmin$ @1 [" o; |0 D" Z  c; E
whenever  a takeover occurs.
" h. ]6 F: q6 d6 p, y( l
& q5 Q9 Z) ~+ `6 \+ [/ F, w* ?1. Notifies recipients by email in the event of resource takeover8 A7 F. Z7 k: f6 J
$ d0 f, Y' D# E$ i2 H
  id (required)  (unique)! q1 D, V% N; D4 j- X
      Identifier for the cluster resource
# m2 {/ i- m! C  email (required)
# {  O' N! G& G5 H7 Z- A9 B      Email address
. k  J  h2 N6 s# ~9 E+ t  subject
# J* K1 C' D" T      Subject
3 |0 P4 Z' L" RCOPY
" i4 z, S8 @. P2 WThe output of show contains a title, a short description, and a procedure. Each procedure is divided into a series of steps, performed in the given order.0 U; a2 b+ W7 d3 e$ d- z
4 s- E4 j0 O: d# f0 x. e
Each step contains a list of required and optional parameters, along with a short description and its default value.
7 P- S0 P, e7 Y9 S9 S& l
, A2 n/ t" v+ @# L/ A' ^: VEach cluster script understands a set of common parameters. These parameters can be passed to any script:' A5 y" e, r9 R4 o  A- p' F

7 d4 ?9 t& K% M+ mTABLE 7.1: COMMON PARAMETERS
6 N6 J1 f' b( K4 Y  [  @" u( ]0 W$ Z& ~6 X4 a: @" ]
Parameter        Argument        Description" w! \& c2 a6 q! Z$ E  a
action        INDEX        If set, only execute a single action (index, as returned by verify)/ l& W2 i/ x7 ~; e5 {
dry_run        BOOL        If set, simulate execution only (default: no)5 W! S7 |: Q, ~  E: v! o7 z
nodes        LIST        List of nodes to execute the script for
# D' s- V7 X2 p9 f/ hport        NUMBER        Port to connect to
- t* P9 r0 Q3 F' Y5 B- tstatefile        FILE        When single-stepping, the state is saved in the given file3 a" O0 r: M! c6 o% G& u  g+ g
sudo        BOOL        If set, crm will prompt for a sudo password and use sudo where appropriate (default: no)
2 v5 m( F/ S5 ?) J$ j. Rtimeout        NUMBER        Execution timeout in seconds (default: 600)
5 ~4 j4 L$ a$ i: @user        USER        Run script as the given user3 s3 r2 @: f  G: d" {
7.1.5.2 Verifying and Running a Cluster Script9 p5 G: D+ d0 d0 j
6 o4 {3 ]$ k( b) K2 A( u# X
Before running a cluster script, review the actions that it will perform and verify its parameters to avoid problems. A cluster script can potentially perform a series of actions and may fail for various reasons. Thus, verifying your parameters before running it helps to avoid problems.
; |1 x; a5 a6 c
$ x1 A) J4 b- K- N3 l. |' ~3 F' RFor example, the mailto resource agent requires a unique identifier and an e-mail address. To verify these parameters, run:. |/ y; ?/ F: X* ]8 }

! Y" t  S' _6 N1 S9 S" Ccrm script verify mailto id=sysadmin email=tux@example.org4 U  J) M& Y  ?: V% W2 j1 O
1. Ensure mail package is installed
6 @2 f( ?2 l3 R5 C
6 u: }8 n* j/ o% |4 m- D% G        mailx
, q1 ]; k' b4 ?; m8 G: Q# F. m% k6 o% l0 C' K2 q% F6 X
2. Configure cluster resources
& B" q' }) D8 k4 c# p4 }6 Y3 D: I- G3 x, \3 J4 j! l4 D- E
        primitive sysadmin MailTo
# D5 t- n0 V* @4 f; b7 u% X; O                email="tux@example.org"
' M  ~5 R& O- |' n  T, j8 W: D9 e& K                op start timeout="10"
7 P: O) q9 P* R0 F# _  z$ y                op stop timeout="10"/ r9 V: P1 w% }" G; v$ ?
                op monitor interval="10" timeout="10"
1 e4 v' F4 [" e! @7 {9 f8 E$ O& N. \. I# t: E" t: Y$ x) p
        clone c-sysadmin sysadmin
- B' w0 \; w: \( l: }% V5 }" q+ q3 ~; HCOPY. E3 {- z3 P9 D+ I3 K& V
The verify prints the steps and replaces any placeholders with your given parameters. If verify finds any problems, it will report it. If everything is ok, replace the verify command with run:3 l3 V6 X7 ]/ I5 i  M( H" o
4 E1 ]( X, e" ~- F4 ]" w
crm script run mailto id=sysadmin email=tux@example.org
0 a+ ^8 g, i6 \0 Q3 e- ?( JINFO: MailTo
/ j! w- i0 y, K. `INFO: Nodes: alice, bob
) h& F+ l1 |8 n& C* u% ZOK: Ensure mail package is installed
1 F  t8 B; y* |! }3 ]7 r8 j$ H3 z' VOK: Configure cluster resources' ]7 B3 W5 m4 Q/ Y0 z
COPY) N( k5 N' A9 g
Check whether your resource is integrated into your cluster with crm status:! F  V7 s8 p7 A) `4 R! E

7 E* c. [0 G( \0 j) k! acrm status
! U" ]& v! [. Z8 f) \! V. b1 Q, b[...]
+ R1 e* M: |) ` Clone Set: c-sysadmin [sysadmin]) g1 Q) L: N7 o
     Started: [ alice bob ]
' d* b/ v" S( P, y3 K( s- k) @COPY0 l' K+ K# A9 d; v
7.1.6 Using Configuration Templates# _+ Y6 R* B! ]2 {* t
) r/ P  ?  r& q5 C6 ]
NoteNote: Deprecation Notice' |5 u" b' k' A( w
The use of configuration templates is deprecated and will be removed in the future. Configuration templates will be replaced by cluster scripts, see Section 7.1.5, “Using crmsh's Cluster Scripts”.
) c6 g8 x/ t6 C. L
% g; D9 Q" N: k5 N. z+ nConfiguration templates are ready-made cluster configurations for crmsh. Do not confuse them with the resource templates (as described in Section 7.4.3, “Creating Resource Templates”). Those are templates for the cluster and not for the crm shell.
& R& h$ U2 i% c0 w' i# X0 n5 @7 V* U! L% h$ \; f7 s
Configuration templates require minimum effort to be tailored to the particular user's needs. Whenever a template creates a configuration, warning messages give hints which can be edited later for further customization." [, c5 w( n9 S7 F

  P7 l! k. `! _! [. x: AThe following procedure shows how to create a simple yet functional Apache configuration:
# a# n6 Z" ^( t3 ~- x% b: O' Z& n
Log in as root and start the crm interactive shell:, e+ s6 l% j3 U/ S" N" ]

) P+ |; E) d9 S" b6 G' c8 L0 i  b0 ucrm configure' o" B* j8 w8 J" j9 K2 G( w
COPY5 |8 G7 t6 ?* c5 ?# ]
Create a new configuration from a configuration template:. A$ V) d( f9 H- K' i. o3 \
1 S  A; J6 @' w
Switch to the template subcommand:
8 ~$ |# F5 x) z1 {% o
  ^- M% d( y; Wtemplate
9 u4 p/ D8 C# v+ S0 @8 ]+ p, ]COPY
/ T" n/ ~: F4 R- |- V% JList the available configuration templates:
+ U- I% H& w' x6 a5 Q  C" l
# _) ~1 H2 \  l& k& ~0 \+ J5 Olist templates
# u( r4 n( F0 u8 h( R4 n% tgfs2-base   filesystem  virtual-ip  apache   clvm     ocfs2    gfs2. o* v( q# X6 c; u; ]
COPY
% f0 j* Y! B/ E' a7 ]  E% |% B- {3 o+ oDecide which configuration template you need. As we need an Apache configuration, we select the apache template and name it g-intranet:
+ ^3 c+ s# T; Z6 c4 c) |: e) R  q: |- X/ A& }1 f' G6 c0 W* z# \2 e
new g-intranet apache2 C! ]' V) |' w
INFO: pulling in template apache- r" T2 s* O6 o' w( k" I
INFO: pulling in template virtual-ip
; N) X" b3 S4 h4 k# b9 GCOPY
' n: A) j' P5 r8 oDefine your parameters:3 }8 l) }& h) Z8 U
! ~$ h$ y& r9 n4 E  l( ^! ?
List the configuration you have created:
# c+ G+ g$ n8 ^, z7 T5 ?3 J5 L. X
. D1 C' J  |# Zlist
" r3 m! z9 _) a; kg-intranet% P% h7 o, D$ X! F
COPY# B; R) Y* U/ _& c
Display the minimum required changes that need to be filled out by you:. q. \# \+ V: Z1 }! @: Q  W

& ~8 V, M; W. E: U, Ushow  M4 ?1 G; _% h. T8 g. _
ERROR: 23: required parameter ip not set% m; z% D" F7 Z3 F, S8 a2 V  J
ERROR: 61: required parameter id not set
' I7 T1 j3 }4 |& l# z; {2 R+ bERROR: 65: required parameter configfile not set) K% u* V. x3 {& G6 J/ h& M+ a
COPY' q9 K+ E6 L8 c( r. W9 L; R
Invoke your preferred text editor and fill out all lines that have been displayed as errors in Step 3.b:: Z2 I; T# z' Q

: u$ K/ L2 w0 e! Wedit% u8 Y. y6 u# H* a
COPY
% E# G4 k7 v6 pShow the configuration and check whether it is valid (bold text depends on the configuration you have entered in Step 3.c):% G  m* E) k  f

% f- {' C( [" J2 N% lshow3 A; q) E7 l  f$ V% b! a% k. [
primitive virtual-ip ocf:heartbeat:IPaddr \8 h3 m! K9 N% z, l- J! H
    params ip="192.168.1.101"
) B( s4 I' p0 N8 ?5 A% D: L9 ^primitive apache apache \' A5 M( K# t- K9 I+ y+ b
    params configfile="/etc/apache2/httpd.conf"8 ?5 ?' t. C) P7 `# t0 t1 d
    monitor apache 120s:60s0 {7 P4 T2 w" K$ a: z! ~
group g-intranet \2 }- `, t) U7 `
    apache virtual-ip
* _; g/ ~9 ?1 d) f1 O" U2 }COPY
, E  L, }: e2 z2 j& T: TApply the configuration:
1 K0 T. s' i& i  `! f8 d$ _% _! U9 z  ^7 K
apply
( O& c1 i9 F- q; i1 J1 G7 f0 \cd ..* q% N$ Y8 h. \/ L7 v
show
$ \+ k- G3 a: G( H+ O- E+ w- ECOPY6 z7 B9 ~7 P7 Q% t  n# R
Submit your changes to the CIB:
3 [1 T5 l, I" }! ]: }2 @9 E1 i  V
; G- z5 V. F$ [# ecommit
2 F* ?% N4 x' S+ T! e: ]' sCOPY
" T3 A1 j  P5 d* J7 P1 R4 `It is possible to simplify the commands even more, if you know the details. The above procedure can be summarized with the following command on the shell:
- K/ N4 ?$ `9 p8 o
3 v; ~/ [6 G  a8 Vcrm configure template \' ?- C1 U+ U. q% H; I
   new g-intranet apache params \
# L- D$ j3 R! d5 d   configfile="/etc/apache2/httpd.conf" ip="192.168.1.101"
9 B1 Q# B. U; g' y' F# ^COPY/ F# m* ]  F1 f" f( j
If you are inside your internal crm shell, use the following command:* _0 T( P" G. Y

& L0 \! k% B6 e8 q. k6 x1 }' Q0 k+ V" Pnew intranet apache params \/ ^# z7 G+ L7 x% T% `
   configfile="/etc/apache2/httpd.conf" ip="192.168.1.101", C- y; D8 \9 h# A; r/ D- Y+ `% Z6 ?: D
COPY! T# Y, E9 S9 A, i* X( x- a3 U' M2 e
However, the previous command only creates its configuration from the configuration template. It does not apply nor commit it to the CIB.
( \" \) X1 ^' _6 d+ K: `6 k; E! j
6 O2 }/ ~1 w% K( S" G6 L; N7.1.7 Testing with Shadow Configuration( K! A. f1 |! a$ C, p
' m7 M2 f5 k0 e' a0 C
A shadow configuration is used to test different configuration scenarios. If you have created several shadow configurations, you can test them one by one to see the effects of your changes.4 V) J2 u  ]  A1 B) k7 n, B

* E. u8 B, C' lThe usual process looks like this:
! d5 f4 k3 J" A5 m9 n  r& H# e
7 Z; E5 D' a5 Y1 z: ~Log in as root and start the crm interactive shell:9 N# W# k% G! a& ~' l

+ {4 A/ k; H; U2 D) `% Bcrm configure$ B, ~3 t$ G% s" Q' ?
COPY
. F; V0 k6 h3 E+ N9 [3 h* HCreate a new shadow configuration:
0 e: ^8 [8 v2 i+ {3 D. `4 S2 g
" A7 H5 K6 P! G$ m! Ecib new myNewConfig
  U5 F6 D8 }, Q8 BINFO: myNewConfig shadow CIB created
  |& \5 Y! r  M( kCOPY; W! w' C+ ]4 S( K+ e4 @+ n
If you omit the name of the shadow CIB, a temporary name @tmp@ is created.( W  y& G, l# Z3 ?2 a

/ H1 _( p& q" z" uIf you want to copy the current live configuration into your shadow configuration, use the following command, otherwise skip this step:
1 K8 l, P# K  \" o" C3 U* {; V( ^% ]1 ?0 y
crm(myNewConfig)# cib reset myNewConfig5 ?& y' ~9 h' \$ S* \9 }5 k8 D: ]6 \
COPY5 ?- M  K, X3 z# ]3 l! H% k
The previous command makes it easier to modify any existing resources later.
# j; `1 `9 m0 }% ~  M* X" p/ v+ P/ F5 ]0 i2 z/ j
Make your changes as usual. After you have created the shadow configuration, all changes go there. To save all your changes, use the following command:4 f" a8 ^  Y4 E0 A9 T8 i

. }0 N+ Q% R# b" icrm(myNewConfig)# commit, R3 O) U$ {+ F! f
COPY
4 @: `  d" S$ J+ f4 pIf you need the live cluster configuration again, switch back with the following command:: _; l4 C3 R7 g' ^6 O3 k+ B

) Q6 x% s- a$ S3 m" Ocrm(myNewConfig)configure# cib use live
. o; p3 j& F; {( U6 }7 S: wCOPY
, p1 ?: G' r' N2 t4 j/ i1 V7.1.8 Debugging Your Configuration Changes
. x- c5 ]% Z' g$ }4 P$ a7 j8 _1 o! e& m; ^) z
Before loading your configuration changes back into the cluster, it is recommended to review your changes with ptest. The ptest command can show a diagram of actions that will be induced by committing the changes. You need the graphviz package to display the diagrams. The following example is a transcript, adding a monitor operation:; W3 M' j( ~* m' o
, Q% _( }- D5 Q5 T' }/ ~* W  L
crm configure4 X0 N% l; D) v) a0 D
show fence-bob4 |0 {3 K9 o. |0 P" V
primitive fence-bob stonith:apcsmart \/ P  J+ ?  ~" l: s) F3 f8 t) \
        params hostlist="bob"
. E% v6 n0 h$ b& v2 m4 k( ~monitor fence-bob 120m:60s* u% X8 j0 }; e! H2 ^# e% ^. @8 u
show changed
4 G& \8 k/ U, w- b) Xprimitive fence-bob stonith:apcsmart \
. n& K, Y2 E2 N) a) l3 {! `        params hostlist="bob" \/ m$ M! K, g8 D4 q
        op monitor interval="120m" timeout="60s"6 B  T  j: k- F9 J
ptest6 O8 I0 j! q( v
commit
3 H! W3 ?) s- }: ^2 tCOPY& O2 r3 N2 x; x4 c9 w
7.1.9 Cluster Diagram
5 V5 W* \8 K/ ^6 l: e0 ~' h- ~5 C% i5 `4 t5 G/ m" Q
To output a cluster diagram, use the command crm configure graph. It displays the current configuration on its current window, therefore requiring X11.4 T) g! i* B- e. {( o$ e8 o
3 @2 ?8 l7 \, T: _- ]3 h8 F
If you prefer Scalable Vector Graphics (SVG), use the following command:
/ c+ T3 J: |+ u( K4 T6 h5 D" Y/ C6 e! \1 y, @
crm configure graph dot config.svg svg
' @2 Y, y( \( e9 k" e5 O1 VCOPY
) @5 u. s4 O) F+ Y7.2 Managing Corosync Configuration! O% }9 u+ B: ^+ e$ O7 k+ x

' {; \3 k5 t1 l  Z  w) BCorosync is the underlying messaging layer for most HA clusters. The corosync subcommand provides commands for editing and managing the Corosync configuration.
3 {! Q" L* s; e2 X  s
" ?6 p' y" r3 y3 ^4 vFor example, to list the status of the cluster, use status:
& |& m% H3 }& ?. i. i
9 f8 B. A4 ?- `$ L/ Tcrm corosync status% K4 ?5 x/ Z' V5 U& ]
Printing ring status.: |: D9 b3 q' ]# k! l* x$ [
Local node ID 175704363
' j/ j, o$ X5 X. s/ C$ y5 a- RRING ID 08 J6 H4 h: j( r2 o* w
        id      = 10.121.9.434 v( C! ^  M( t. E1 m+ }5 d
        status  = ring 0 active with no faults, H  _3 ?8 j7 _8 S; I6 d7 [
Quorum information
. {7 h3 a$ \0 \7 F& j  C/ P* u$ r------------------
7 \& \8 x! \. h# z  L) p5 oDate:             Thu May  8 16:41:56 2014( u2 D9 A/ [" M  b; b
Quorum provider:  corosync_votequorum
9 h" C# `# q. G5 o# o5 N& [' M" H4 rNodes:            2
& B8 W( J2 {& ENode ID:          175704363) B( x, V3 b1 Z' [. c) u" a
Ring ID:          4032
  _6 u+ }' i( B4 eQuorate:          Yes5 f) X# \8 [& X( \% o

7 c. S8 M# l& K& V! Y/ s5 g! x* `Votequorum information6 R  i4 @' ]) D/ b+ E% y0 q: `7 b
----------------------) y& w- o* d# v3 b
Expected votes:   2  w3 G6 ~0 R1 c0 i
Highest expected: 2
) M+ P4 E: f0 x2 YTotal votes:      2
! G1 E; |! q) a1 Y( f2 ZQuorum:           2; K0 T2 B  l* n" j' s. l
Flags:            Quorate
1 v8 l5 \0 `$ n1 p/ c* Q
! |" k2 p4 c2 eMembership information
9 x3 y& d5 i$ k+ J: F----------------------' G, y) z, C$ J. `! a
    Nodeid      Votes Name8 G. F* ^5 W  r( k  w
175704363          1 alice.example.com (local)
# A' ~% @9 ]- ~, H8 d 175704619          1 bob.example.com3 w# q/ j# b% E& N5 s
COPY
# l, ~& |: Q7 n6 U1 C9 iThe diff command is very helpful: It compares the Corosync configuration on all nodes (if not stated otherwise) and prints the difference between:
' x, z3 ^" K5 |
3 U* i) _* n/ `9 h; d  v  o9 Rcrm corosync diff
1 ]3 {3 b8 n, @" u3 n) d' [; F# A' X--- bob. N$ J5 Q) ?1 {: ~# `4 e
+++ alice
1 Q5 M: v; a* ~2 l$ |/ E@@ -46,2 +46,2 @@
, F( _3 y# v7 _$ V% v. h-       expected_votes: 2
  ]* i' f+ v' W-       two_node: 1
5 a) x% c$ }: P9 L. }5 I- A$ Z+       expected_votes: 1
2 e: Y- x! C) j; h) B  p! O+       two_node: 0
+ h; f$ p4 L. J1 ~) f* R, hCOPY1 m9 `( _  _( b' N' P
For more details, see http://crmsh.nongnu.org/crm.8.html#cmdhelp_corosync.
$ s, X3 I5 c# U4 Z
5 @! Q2 m  j# B  a7.3 Configuring Global Cluster Options
! H+ p6 M* ]- u9 ?# W/ }1 d. s* x- y* R. [, ~. I- o7 O3 O+ Y
Global cluster options control how the cluster behaves when confronted with certain situations. The predefined values can usually be kept. However, to make key functions of your cluster work correctly, you need to adjust the following parameters after basic cluster setup:. C, v" ^. |7 d  d! B- y" ?8 t/ `
5 ?6 F& U& T& }, D0 E! m2 V8 L
PROCEDURE 7.1: MODIFYING GLOBAL CLUSTER OPTIONS WITH crm7 S# x' Y; o5 _+ C( S) h1 S" g
1 q+ O) \' r9 b
Log in as root and start the crm tool:$ `6 l2 F. Q* N7 Z' q
9 ?* N  M/ D. ?9 E) \7 @7 _/ z
crm configure
( ?8 G1 Z/ j' |  ~COPY
8 }. _% ], G( ?: h7 J# X$ `" T: sUse the following commands to set the options for two-node clusters only:
! e+ M* J- ^+ B& w% [. X; L! c% C: q% P+ l+ Q
property no-quorum-policy=stop
. \# M5 |) G7 R2 U/ g0 }" `0 o% k  lproperty stonith-enabled=true
# |6 c7 R: a$ c) I* ECOPY
: |7 _4 n" P1 q0 _! Q# FImportantImportant: No Support Without STONITH( v# D( i! J' T
A cluster without STONITH is not supported.5 ^( f# m) O5 s/ d2 R
5 J! A6 l8 Q# V# z$ A4 Q1 Q" C2 @
Show your changes:
- ?9 g& Z* o! W& M  o
8 y* c# n8 V# y( a5 A* D/ Ashow) V4 D1 s6 L. j$ o
property $id="cib-bootstrap-options" \
' X7 I; i# t0 K  M   dc-version="1.1.1-530add2a3721a0ecccb24660a97dbfdaa3e68f51" \/ C0 n+ W; Z: Q. i9 y
   cluster-infrastructure="corosync" \2 S9 w# b* D4 B
   expected-quorum-votes="2" \
* I! ^8 H  D" U6 a9 p: M6 U   no-quorum-policy="stop" \
$ P, }: @" Y. {9 o! u' n   stonith-enabled="true"5 S* i5 K& q2 ]9 W# W# }* N, j
COPY2 W$ H6 V6 r$ l: D4 K
Commit your changes and exit:. i+ _5 E7 G  o# ?, |
3 R) V3 |( r2 O$ V
commit: i2 Z/ s* R, X* c# ?- A
exit9 C9 g; J3 B0 N' R* y% u
COPY; h/ I4 ]+ S& {1 k; n
7.4 Configuring Cluster Resources; ]' Y8 f7 S; N, a% V, P: P
4 D5 J! \9 h) j, f
As a cluster administrator, you need to create cluster resources for every resource or application you run on servers in your cluster. Cluster resources can include Web sites, e-mail servers, databases, file systems, virtual machines, and any other server-based applications or services you want to make available to users at all times.
8 O1 R! o$ b: j& D$ _. i( B* g' v0 e1 [: a6 ~
For an overview of resource types you can create, refer to Section 5.3.3, “Types of Resources”." H" g1 C- T& Q- n$ ~% ^: K( n

! n: i* ?5 ^4 X7.4.1 Loading Cluster Resources from a File
2 o% m6 N$ A% A1 q' u' o& ?& D, W3 I5 t; `; }; w
Parts or all of the configuration can be loaded from a local file or a network URL. Three different methods can be defined:
4 c% w; U+ v! {( W1 z: j; n
4 i$ F& R3 X+ Q, J( L+ K0 jreplace
: i3 P* R+ A( G- A3 b8 M" pThis option replaces the current configuration with the new source configuration.
/ {) `  |& G1 Z- z  ~
5 w  Y1 D# B4 J8 z( u/ u/ U8 n. cupdate
( ~- x. x! y2 h/ m1 E  EThis option tries to import the source configuration. It adds new items or updates existing items to the current configuration." i1 O( V) r2 i  w
# b. f# O# H- h! i
push& F# z( w# b: d$ T
This option imports the content from the source into the current configuration (same as update). However, it removes objects that are not available in the new configuration.% z7 ?7 K4 l: y' o! }

- Q; z$ L) I% l$ ^& d& wTo load the new configuration from the file mycluster-config.txt use the following syntax:) J  `3 v1 r( C. X" I0 ~
) O6 Z0 B- _, f1 Y
crm configure load push mycluster-config.txt0 |) X( G! R: b/ C# i6 P. ~
COPY
. a; H% o( I" `) }6 B" M* d; J7.4.2 Creating Cluster Resources. d5 M4 @! |! ?2 g" q6 W

" s' i$ }: O5 w% ^7 l8 j0 [There are three types of RAs (Resource Agents) available with the cluster (for background information, see Section 5.3.2, “Supported Resource Agent Classes”). To add a new resource to the cluster, proceed as follows:
! O5 q( }. W$ Y% Y6 v" H% X
- s- N% q# _. `. B* x; dLog in as root and start the crm tool:
; _3 U$ A8 z: p$ k: W. z& L; B/ k  w$ G$ j" f# Z
crm configure3 w$ r# y  E% X8 r" L
COPY
; |, x2 E) U8 K. X0 l1 i* eConfigure a primitive IP address:2 A2 N# S" F" ^  d( N

' d& Z( n% Q: y  Y+ iprimitive myIP IPaddr \* ^# s5 X0 _* J( ?; c
     params ip=127.0.0.99 op monitor interval=60s0 w9 D- V9 s3 x/ s' z
COPY8 G6 o8 f. z& f4 E3 x
The previous command configures a “primitive” with the name myIP. You need to choose a class (here ocf), provider (heartbeat), and type (IPaddr). Furthermore, this primitive expects other parameters like the IP address. Change the address to your setup.
' {0 o" g- J* u; ^+ _
8 g8 l3 n' V" W9 JDisplay and review the changes you have made:' j) F  n# b2 A  }

2 B1 y4 x! i! c6 [1 X1 |: ^/ ashow
, `6 k+ n8 Q% x  }& z2 s5 sCOPY/ h$ ^! b3 F% P" m4 D; V
Commit your changes to take effect:9 a- [; k' G% O3 {

; ~7 N+ t* {; \) ccommit: R3 _. R& }; ]9 _; h
COPY
2 v5 T+ W9 w" q7.4.3 Creating Resource Templates4 f2 D1 J3 J+ X* X: v  E

5 H( s* ]. L8 D! FIf you want to create several resources with similar configurations, a resource template simplifies the task. See also Section 5.5.3, “Resource Templates and Constraints” for some basic background information. Do not confuse them with the “normal” templates from Section 7.1.6, “Using Configuration Templates”. Use the rsc_template command to get familiar with the syntax:
- U2 s7 c, F1 ?6 e6 K- h( `9 j! }, |6 l6 U9 K" K, b* T
crm configure rsc_template
. s/ i( B6 S  V6 d* ?usage: rsc_template <name> [<class>:[<provider>:]]<type>
! t" c7 X7 L( Y9 u* `        [params <param>=<value> [<param>=<value>...]]
6 `$ F/ l* X7 r$ v7 I, e8 A- j        [meta <attribute>=<value> [<attribute>=<value>...]]
5 b# v) J' x: h* h$ L  B4 U        [utilization <attribute>=<value> [<attribute>=<value>...]]8 c4 U3 e2 O. ?% D3 f- G% b- R, V
        [operations id_spec& ], V, c, _$ Y" J- u8 S
            [op op_type [<attribute>=<value>...] ...]]7 Y, H! r8 i' O; D
COPY
( [" F2 s1 v( E$ n4 \: EFor example, the following command creates a new resource template with the name BigVM derived from the ocf:heartbeat:Xen resource and some default values and operations:
: {2 v! j' e; ~5 V) J- h% }+ d- n* _; Z
rsc_template BigVM ocf:heartbeat:Xen \, s$ W6 Y! J) S7 C" {# a: U
   params allow_mem_management="true" \  s" i/ m* a/ p7 N1 k
   op monitor timeout=60s interval=15s \
' w' m7 K$ N! G5 R* `3 c+ R   op stop timeout=10m \( v6 y# V$ e4 H$ ?( Q
   op start timeout=10m9 V  e! E, }  b% _$ K/ j
COPY
" a/ [' p1 G- e- ~Once you defined the new resource template, you can use it in primitives or reference it in order, colocation, or rsc_ticket constraints. To reference the resource template, use the @ sign:
; l2 A( j( g+ W3 C) T! R- n& t3 X" r
primitive MyVM1 @BigVM \
* C/ m0 O% R, c3 [9 @* j   params xmfile="/etc/xen/shared-vm/MyVM1" name="MyVM1"
6 t# u. m' n5 ^9 R: P  wCOPY5 j, \! K7 W# {8 T) [4 }
The new primitive MyVM1 is going to inherit everything from the BigVM resource templates. For example, the equivalent of the above two would be:& r: L; S9 t: F" d
2 U- d" X! i3 S: l6 _7 h: x
primitive MyVM1 Xen \. V$ y- o, |4 p" m5 h
   params xmfile="/etc/xen/shared-vm/MyVM1" name="MyVM1" \
3 l  p- h' g3 d* h3 O4 y1 h   params allow_mem_management="true" \
& a# i. z5 d0 N   op monitor timeout=60s interval=15s \
: C( i( R( b4 C   op stop timeout=10m \
+ A% R, s+ A7 C9 m   op start timeout=10m9 \2 w3 j2 Y' s. ?/ T+ C
COPY
! {: _, y4 N# G+ D" {If you want to overwrite some options or operations, add them to your (primitive) definition. For example, the following new primitive MyVM2 doubles the timeout for monitor operations but leaves others untouched:' b$ Q+ h  G0 v+ c1 b" C& G9 Z8 f
' r# \- G. _' h
primitive MyVM2 @BigVM \- W2 O6 E7 P! R" z( v, a0 v
   params xmfile="/etc/xen/shared-vm/MyVM2" name="MyVM2" \  @) e, `5 O5 c5 N8 u
   op monitor timeout=120s interval=30s
. o0 ~1 t2 H% k  y  N7 l+ @COPY
! {+ Q: X$ v7 q# jA resource template may be referenced in constraints to stand for all primitives which are derived from that template. This helps to produce a more concise and clear cluster configuration. Resource template references are allowed in all constraints except location constraints. Colocation constraints may not contain more than one template reference., t0 D* a# ~% G1 s/ ^
. T, t- ]3 O" d5 h6 W8 \
7.4.4 Creating a STONITH Resource* q$ j& ?& W6 S& n3 Q/ u9 Z
/ N0 Z) q% p4 T- G
From the crm perspective, a STONITH device is just another resource. To create a STONITH resource, proceed as follows:
$ m5 K. W# C. ?6 B7 J: [5 i9 L( o1 s7 [1 ?2 H
Log in as root and start the crm interactive shell:; B- v7 \# N1 x# {: z( w2 U& U

2 o; L; m" J8 B  G" p  wcrm configure& s0 m2 g' O! V# S7 z
COPY
& q* a- h) P, xGet a list of all STONITH types with the following command:+ B" D& Y5 j3 {% C/ s! }' V

' L/ g( u: K+ ]9 A# d5 Wra list stonith/ }+ ?: D5 S" y- x
apcmaster                  apcmastersnmp              apcsmart$ p- ~! e, ?; @! E* X1 _
baytech                    bladehpi                   cyclades' `( x0 c7 Q! {( ~9 n0 f
drac3                      external/drac5             external/dracmc-telnet; I9 j6 h4 p0 N9 P/ Q7 I  V
external/hetzner           external/hmchttp           external/ibmrsa
  o7 S0 S( K+ t, Yexternal/ibmrsa-telnet     external/ipmi              external/ippower9258
; K1 C) w- Y. b* gexternal/kdumpcheck        external/libvirt           external/nut
  E; k& d9 O  f9 V2 t- T0 }7 jexternal/rackpdu           external/riloe             external/sbd. x; L4 j; ?8 M. J
external/vcenter           external/vmware            external/xen0+ D" S  Z1 f4 a6 K% O2 ?
external/xen0-ha           fence_legacy               ibmhmc
7 r% i+ j7 Q" N8 k4 yipmilan                    meatware                   nw_rpc100s2 r0 ?& ?0 B+ I' K1 a" l
rcd_serial                 rps10                      suicide
3 [; ]8 t/ k3 P- Cwti_mpc                    wti_nps/ |+ Z) I$ R; e4 ?9 p
COPY
* x# X% [2 x* \3 Y" T0 tChoose a STONITH type from the above list and view the list of possible options. Use the following command:6 P& O# b$ j8 p: a# G" f2 c
) }, h  [* q' a& ~5 V: e8 ?( ]
ra info stonith:external/ipmi
3 b- t- p! Q9 M# D% d' ^3 f5 \IPMI STONITH external device (stonith:external/ipmi), e: d( c4 v% B& Z+ G$ d7 V

! H# n( A5 N) U% W: B' [( ?8 R0 S  Jipmitool based power management. Apparently, the power off
2 \5 w" D6 J# B; I# pmethod of ipmitool is intercepted by ACPI which then makes
. W4 `. S0 _6 o( s+ Ga regular shutdown. If case of a split brain on a two-node/ ]* f  E& N* C9 ^) ~. {& g
it may happen that no node survives. For two-node clusters
5 s8 i" |& z* ^2 e; W2 |use only the reset method.
0 _& P( G* h7 P' h3 p0 F1 k, Z9 h
Parameters (* denotes required, [] the default):. i: g- w" Q# {/ t2 W# v
5 m1 V' k4 x' B/ s# y4 i, y3 \
hostname (string): Hostname
; L) F9 [& B$ e: y' n    The name of the host to be managed by this STONITH device.
6 ]5 S( B) J1 s0 F4 x...
5 t" {( ~" k0 S3 {COPY5 p3 [8 J+ N+ l: C' D5 ~- N7 u
Create the STONITH resource with the stonith class, the type you have chosen in Step 3, and the respective parameters if needed, for example:4 p  D1 t# H; Y! t! I" A
- w  ^. J# S9 {/ ]( l
configure
2 ^9 c6 G8 c: C0 ?1 n6 f6 h! y0 fprimitive my-stonith stonith:external/ipmi \2 L+ L) e2 b8 F1 R; g
    params hostname="alice" \* a5 U* q# P& b, ~
    ipaddr="192.168.1.221" \) b3 t9 s1 C$ `# l) F3 k9 W" [
    userid="admin" passwd="secret" \7 h& D  y9 f; ]9 y) K
    op monitor interval=60m timeout=120s) Y7 Z3 ]% u% f- p" h
COPY
1 t" Q: ?: ^% G7 s! _) O' f7.4.5 Configuring Resource Constraints
; W; f; w) F) e0 I, X
" X, E1 v8 Q0 D5 z9 vHaving all the resources configured is only one part of the job. Even if the cluster knows all needed resources, it might still not be able to handle them correctly. For example, try not to mount the file system on the slave node of DRBD (in fact, this would fail with DRBD). Define constraints to make these kind of information available to the cluster.
& e0 S- I# |! U+ O2 l
9 u; |( F4 i: R7 nFor more information about constraints, see Section 5.5, “Resource Constraints”.! k1 [$ j* V! V( p
( s6 g1 X- d  K; y3 |, J
7.4.5.1 Locational Constraints
' h6 \1 I  |. i; }/ {1 J3 g* c0 t$ S9 ^' \" W4 X
The location command defines on which nodes a resource may be run, may not be run or is preferred to be run.
7 H, Q9 ?1 i  w9 f/ D0 ]( y7 M  y: D
This type of constraint may be added multiple times for each resource. All location constraints are evaluated for a given resource. A simple example that expresses a preference to run the resource fs1 on the node with the name alice to 100 would be the following:5 P+ t. [! o! K7 u: J

% e1 E* z4 c7 ~# }location loc-fs1 fs1 100: alice
' ^  C- A( W" \: G( r! y0 gCOPY
, a' C3 f. m, J) u' TAnother example is a location with ping:; r" v0 T* ~. A' y& H

# }# _" ^* g6 B$ I. Dprimitive ping ping \- ?* m' ~! T/ I
    params name=ping dampen=5s multiplier=100 host_list="r1 r2". e* O# y( A/ B3 v7 B- g
clone cl-ping ping meta interleave=true# Z" Z' N2 X1 D
location loc-node_pref internal_www \
# d- ]# R# @% R1 M/ @% Y    rule 50: #uname eq alice \
5 P  a6 i/ V- X    rule ping: defined ping
2 c  c/ J: ~* j+ YCOPY
4 E% `) }: r8 m. iThe parameter host_list is a space-separated list of hosts to ping and count. Another use case for location constraints are grouping primitives as a resource set. This can be useful if several resources depend on, for example, a ping attribute for network connectivity. In former times, the -inf/ping rules needed to be duplicated several times in the configuration, making it unnecessarily complex.: o. A& |1 w* z5 d' x7 B& b# [
$ ^$ I. W8 u8 A( g: {0 P4 L
The following example creates a resource set loc-alice, referencing the virtual IP addresses vip1 and vip2:+ n7 }6 P  y4 d, f8 d$ _( ]

% z; C# Y0 W. e$ Aprimitive vip1 IPaddr2 params ip=192.168.1.54 Y/ N7 L) ^& _: C
primitive vip2 IPaddr2 params ip=192.168.1.6* l) k; y+ P. h
location loc-alice { vip1 vip2 } inf: alice# K- b8 m" l4 R6 t- z2 q
COPY
1 K% ]& a9 i. X" XIn some cases it is much more efficient and convenient to use resource patterns for your location command. A resource pattern is a regular expression between two slashes. For example, the above virtual IP addresses can be all matched with the following:
% i/ s  j8 o0 r, ?5 l6 @$ O! V) y1 a6 j. l% v" v
location  loc-alice /vip.*/ inf: alice' r9 }( g$ j3 z7 k
COPY; H$ j: X! Q3 {+ u9 W% y
7.4.5.2 Colocational Constraints( K2 \7 Y' m$ _- R+ W* [
  H% P2 D1 l+ r3 U
The colocation command is used to define what resources should run on the same or on different hosts.
3 m+ m& v( K- L- `9 n& F
+ E5 M+ i: {% c; \It is only possible to set a score of either +inf or -inf, defining resources that must always or must never run on the same node. It is also possible to use non-infinite scores. In that case the colocation is called advisory and the cluster may decide not to follow them in favor of not stopping other resources if there is a conflict.
4 C; G8 T5 J% F+ _( n0 n
8 J0 e# f1 \0 y9 y7 ]0 sFor example, to run the resources with the IDs filesystem_resource and nfs_group always on the same host, use the following constraint:$ |, h8 M8 C; P8 O; \1 `
0 K/ |  U/ O" ~9 T" Q
colocation nfs_on_filesystem inf: nfs_group filesystem_resource
6 @; A& R; A# v1 w: t8 YCOPY/ d% i$ y' r9 N5 q) \& M
For a master slave configuration, it is necessary to know if the current node is a master in addition to running the resource locally.3 y$ h2 ~8 k9 ]0 q2 @# t% u. r3 C/ H

' M: x$ N% X* e" R8 J7.4.5.3 Collocating Sets for Resources Without Dependency
# b7 y0 j/ P/ z( ?3 U3 N4 v5 G, D" D1 J8 R% h0 _
Sometimes it is useful to be able to place a group of resources on the same node (defining a colocation constraint), but without having hard dependencies between the resources.
0 R+ G7 C; l: d8 {
5 x9 P1 ]& f" q4 J2 @0 ZUse the command weak-bond if you want to place resources on the same node, but without any action if one of them fails.  T& q$ G7 [1 y; k/ G
; g1 {; }: n6 }3 u. m5 c: T3 k
crm configure assist weak-bond RES1 RES20 g! ?' I9 e7 w
COPY. W: \4 c4 ~" P$ q/ r8 u1 a, M3 D
The implementation of weak-bond creates a dummy resource and a colocation constraint with the given resources automatically." i2 e) E  d, h9 D5 J* L
- E0 c2 c3 }- m$ n
7.4.5.4 Ordering Constraints
+ w0 [& k7 ]% L. @3 E2 e4 ~0 ^2 b" ?
The order command defines a sequence of action.
. f; w) t! a) f' s4 X  o3 ^( D3 ]' A2 N9 z1 Q' M( J* x* ^
Sometimes it is necessary to provide an order of resource actions or operations. For example, you cannot mount a file system before the device is available to a system. Ordering constraints can be used to start or stop a service right before or after a different resource meets a special condition, such as being started, stopped, or promoted to master.: W5 {2 z. V. p. ]" R! b' S! G6 N- C& A

( N  M7 \  i5 s5 E$ iUse the following command in the crm shell to configure an ordering constraint:
! t; V" F1 V$ S1 b: e
: z) W( `' }1 J, ?; jorder nfs_after_filesystem mandatory: filesystem_resource nfs_group
: e3 M+ u' x" h& u" vCOPY
( M( L( K( f) @( l5 H8 l7.4.5.5 Constraints for the Example Configuration
( C( U; M. v) N' A2 h; ?/ D, M) \  f
The example used for this section would not work without additional constraints. It is essential that all resources run on the same machine as the master of the DRBD resource. The DRBD resource must be master before any other resource starts. Trying to mount the DRBD device when it is not the master simply fails. The following constraints must be fulfilled:
# }& R' Z+ R( C$ C* m' d* X9 X- V7 M* u) ?* W
The file system must always be on the same node as the master of the DRBD resource.
9 |* P3 h6 t* t4 k; N! J' ^# q/ x5 F7 @
colocation filesystem_on_master inf: \/ `+ O* T6 r# k: s$ b
    filesystem_resource drbd_resource:Master
6 X2 D/ h( Y9 l' {3 n  `! }COPY: u* T$ D1 w: q- L+ i# W
The NFS server and the IP address must be on the same node as the file system.
3 |1 J$ t" O- U# V* G
/ _+ U6 e2 @; d5 Ecolocation nfs_with_fs inf: \
7 J1 }0 w2 A$ u4 m8 j! F7 v" y   nfs_group filesystem_resource
) M% @' q0 X/ G5 e( \; vCOPY
4 q9 z. p7 W8 U" c9 aThe NFS server and the IP address start after the file system is mounted:
% L# D, Q! ]( M' V6 {+ [7 v9 T
2 R3 Q' y* L$ \6 k' J% morder nfs_second mandatory: \! m6 e) _. O3 P1 _
   filesystem_resource:start nfs_group
& n. q6 e& u9 j) \" xCOPY
( Z2 }# k0 _- \The file system must be mounted on a node after the DRBD resource is promoted to master on this node.: a  I' }2 M6 M* R: a

, L! l3 E- n  f1 i8 r( i0 ~" Y' xorder drbd_first inf: \* h0 t6 W! X) j; m4 x; G# M
    drbd_resource:promote filesystem_resource:start
5 }8 V) }3 u* D- {  P5 f( ~COPY
& I6 p1 E9 W" e6 @( q. j1 q7.4.6 Specifying Resource Failover Nodes
6 x; U- G4 U8 w% ]3 L) _
9 \* y, ~8 Y: W. |; {! hTo determine a resource failover, use the meta attribute migration-threshold. In case failcount exceeds migration-threshold on all nodes, the resource will remain stopped. For example:
; O8 K8 q( G2 }3 C" ]1 l, o8 q
location rsc1-alice rsc1 100: alice( U/ y9 j* i5 X# R- d) v
COPY- u3 @) h  E" G7 j3 I
Normally, rsc1 prefers to run on alice. If it fails there, migration-threshold is checked and compared to the failcount. If failcount >= migration-threshold then it is migrated to the node with the next best preference.' i2 P# ], @6 D$ D4 I" A
! s5 ?$ d: V7 H+ F7 e" R) M# j$ i
Start failures set the failcount to inf depend on the start-failure-is-fatal option. Stop failures cause fencing. If there is no STONITH defined, the resource will not migrate.
- @: B( D1 Z4 ^" H5 \& v' F& b$ g, P+ C* I3 G* H6 A
For an overview, refer to Section 5.5.4, “Failover Nodes”.4 e, h0 J' o: a7 G
, B3 O) o; t( }9 t, ~/ M' @8 n
7.4.7 Specifying Resource Failback Nodes (Resource Stickiness)
. E4 i  j7 |) J. h; L: s' j% K. P: I1 l; S" A: Y
A resource might fail back to its original node when that node is back online and in the cluster. To prevent a resource from failing back to the node that it was running on, or to specify a different node for the resource to fail back to, change its resource stickiness value. You can either specify resource stickiness when you are creating a resource or afterward.
9 c7 w7 C% |3 C2 n7 k0 S7 g5 B
8 H5 n1 g6 U. @7 m: t. \For an overview, refer to Section 5.5.5, “Failback Nodes”.
  x8 {5 y7 a: y$ F* ]3 v) [
+ h/ Q" m, ?& h8 C" `4 ]/ x0 U7.4.8 Configuring Placement of Resources Based on Load Impact5 a4 X: v/ q# W5 X$ [$ }0 y

- ?# i% ^& {* k+ u* {8 d2 WSome resources may have specific capacity requirements such as minimum amount of memory. Otherwise, they may fail to start completely or run with degraded performance.
& `+ Z/ e* @: S" }( O) b/ e2 t- f+ h) N9 ]  B/ b) \( Z
To take this into account, SUSE Linux Enterprise High Availability allows you to specify the following parameters:7 n! n2 j* a0 ~) R( D1 X
4 g8 ^# ]# B. o: R4 O; }
The capacity a certain node provides.
4 b4 f5 \8 u  R, l& `+ P
( Q$ I' K( @& \) D$ x7 p0 ZThe capacity a certain resource requires.
% c# ~* {, h" t, Y' G2 r* Q. H! T
. I! F" u& X/ k! j* Z9 NAn overall strategy for placement of resources.
/ u* p* M/ t' T& @" p  H" l: N# D1 C$ H4 o( {9 {
For detailed background information about the parameters and a configuration example, refer to Section 5.5.6, “Placing Resources Based on Their Load Impact”.' u( K6 F5 @; o" U. `& q; W

7 I3 I8 [' ?! q. f3 MTo configure the resource's requirements and the capacity a node provides, use utilization attributes. You can name the utilization attributes according to your preferences and define as many name/value pairs as your configuration needs. In certain cases, some agents update the utilization themselves, for example the VirtualDomain.
  g' W" _* Y0 ^1 @8 q& m1 S( G$ b$ x
In the following example, we assume that you already have a basic configuration of cluster nodes and resources. You now additionally want to configure the capacities a certain node provides and the capacity a certain resource requires.
. z. V/ k& y% \
- @& V2 l8 x' X. CPROCEDURE 7.2: ADDING OR MODIFYING UTILIZATION ATTRIBUTES WITH crm
( _5 }: F5 s7 c5 x: G" [7 g) H  l2 n/ }1 B2 q( p
Log in as root and start the crm interactive shell:
+ r" H! u. t7 N6 o# A: [" Y/ c4 P
crm configure/ v- \7 a4 M4 e. U' h) j
COPY
* |, L3 {/ b- CTo specify the capacity a node provides, use the following command and replace the placeholder NODE_1 with the name of your node:
* q" e2 s# M& Y$ {8 x" {8 E* Q8 f9 l: L' U' \+ F& Q7 ?
node NODE_1 utilization hv_memory=16384 cpu=8  m" I$ D& z: e. T6 f7 }7 b
COPY
6 a* x- F7 ~( Q) Z' \% e- mWith these values, NODE_1 would be assumed to provide 16GB of memory and 8 CPU cores to resources.
" X5 M# J. L/ R4 e/ @, y' o0 v/ Q6 u: x- S6 z# X/ Q- [
To specify the capacity a resource requires, use:4 I5 E& D7 [. G" ?1 l0 U' ?

$ U. S8 m# A4 h8 i" Hprimitive xen1 Xen ... \
. \1 ~+ R( M& p! w' U: j- z! ^$ G     utilization hv_memory=4096 cpu=46 x( n9 R1 e; t4 o# ?7 o
COPY
$ V; N' J" A% ?This would make the resource consume 4096 of those memory units from NODE_1, and 4 of the CPU units.
+ u% E) g- Q4 G% [! o- ?( u
/ |0 @& F3 b  l) `0 ]* m$ DConfigure the placement strategy with the property command:
3 V+ C, K  H+ K: m2 p  C% h  _3 g5 m: I
property ...
& F/ `% `( B3 Z1 e; qCOPY
+ C3 U% d/ i& HThe following values are available:
  M- B" Q" y9 I: ?; Q+ s, |
* m3 Z( h- P$ A  fdefault (default value)
' N& ~. X2 U/ E; j+ _Utilization values are not considered. Resources are allocated according to location scoring. If scores are equal, resources are evenly distributed across nodes.5 A- k9 s& b- k( c# V$ o
& R2 f8 g+ Z. V' L- r8 s: u
utilization$ @! c( @. X1 ^3 |7 l$ q) U
Utilization values are considered when deciding if a node has enough free capacity to satisfy a resource's requirements. However, load-balancing is still done based on the number of resources allocated to a node./ O- ^8 k5 C& W7 N" E# Z* j, w& v
: i& ]! ]: ^- ^( |$ V
minimal
2 t. N8 a9 `# o3 D, k4 R8 ^% o2 ?! ?Utilization values are considered when deciding if a node has enough free capacity to satisfy a resource's requirements. An attempt is made to concentrate the resources on as few nodes as possible (to achieve power savings on the remaining nodes).
) \7 L1 G" e- o: Z
; @# m- D( ~. [2 w' Z8 vbalanced
" [- j3 G$ f" ]  C" wUtilization values are considered when deciding if a node has enough free capacity to satisfy a resource's requirements. An attempt is made to distribute the resources evenly, thus optimizing resource performance.; z/ Y" ?# u$ j* T( ?1 X, g5 c+ M

: _8 b! F) q7 Y+ C: n( mNoteNote: Configuring Resource Priorities
# v$ ?7 S8 L1 RThe available placement strategies are best-effort—they do not yet use complex heuristic solvers to always reach optimum allocation results. Ensure that resource priorities are properly set so that your most important resources are scheduled first.) ^0 f  o5 i) n, l; C& A
3 v7 D; j( ~# X
Commit your changes before leaving crmsh:* z- u1 ^: \1 ?7 ~& ]3 k

5 {, Y  \! o# J' ]& Lcommit
4 G& i" O8 j: k2 \, P& h& FCOPY9 t& {0 z5 I' @. l
The following example demonstrates a three node cluster of equal nodes, with 4 virtual machines:0 Q1 e% V' h! N8 e, D4 H
6 D1 \/ p) |7 k# C$ S: Z4 N
node alice utilization hv_memory="4000"
6 a4 `! v- M$ [# l% n4 u& j* snode bob utilization hv_memory="4000"
1 ?9 b( h  U; e" V" Rnode charlie utilization hv_memory="4000"
7 q0 M9 x8 I$ K& C2 M! Kprimitive xenA Xen \& E! G; P0 w6 d
    utilization hv_memory="3500" meta priority="10" \
0 [  ?* z6 x* y+ c+ V    params xmfile="/etc/xen/shared-vm/vm1"
( O5 b3 n4 _( B& o2 K3 Vprimitive xenB Xen \
; A( `1 n3 S8 b0 Y4 q    utilization hv_memory="2000" meta priority="1" \! Q- i4 D1 C& u2 |: v4 Q5 W
    params xmfile="/etc/xen/shared-vm/vm2"1 l% j' r% Q6 ]6 R6 Y$ c) w' P
primitive xenC Xen \2 ^& A! C9 D  d
    utilization hv_memory="2000" meta priority="1" \' L6 g8 V5 y$ ?& r3 t
    params xmfile="/etc/xen/shared-vm/vm3"
& g0 p0 x7 P0 X! B; cprimitive xenD Xen \
" e& J' B. b. k4 q$ ~7 Z# F    utilization hv_memory="1000" meta priority="5" \9 |7 A# ]% h. H: @
    params xmfile="/etc/xen/shared-vm/vm4"+ L$ a& [% S  v; Q# {
property placement-strategy="minimal"4 h/ l6 l0 u/ c# P% h; C
COPY9 I; ]8 y* \! s+ O
With all three nodes up, xenA will be placed onto a node first, followed by xenD. xenB and xenC would either be allocated together or one of them with xenD.7 Z" I9 H. p1 Z* `% \

' x0 W# p3 X: E. aIf one node failed, too little total memory would be available to host them all. xenA would be ensured to be allocated, as would xenD. However, only one of xenB or xenC could still be placed, and since their priority is equal, the result is not defined yet. To resolve this ambiguity as well, you would need to set a higher priority for either one.% Y$ s* t  P: n9 J# _

& p: X+ Z# R# N( `  i8 W  A" g, X7.4.9 Configuring Resource Monitoring6 w0 j) L+ a* b

  W, \' C# b& l8 d5 |To monitor a resource, there are two possibilities: either define a monitor operation with the op keyword or use the monitor command. The following example configures an Apache resource and monitors it every 60 seconds with the op keyword:2 T( b6 Y$ r/ T4 X  t3 F

5 V& a- ~0 n6 zprimitive apache apache \
& W2 X5 p9 ?0 B4 \8 P! q$ B  e# h  params ... \, R2 y: o, O) U, L* E- {
  op monitor interval=60s timeout=30s7 J9 X2 u$ n% y; ?' c! h/ B
COPY6 c; J6 Y& [, j, }
The same can be done with:
0 n- V/ O- G- _1 i' C  s' J8 {) l! s1 v
primitive apache apache \8 a9 k, _' z* \
   params ...' T2 j" ~+ M; L3 `- v  R  _' M) o9 u
monitor apache 60s:30s9 o5 `9 U% O  S  n8 L: O7 J& O
COPY
1 T& p2 l# H8 xFor an overview, refer to Section 5.4, “Resource Monitoring”.
/ g% ~2 h+ U: Z" e& l& T* i3 y, H% q5 f7 c7 H# g# ]8 m5 H0 H4 s
7.4.10 Configuring a Cluster Resource Group4 u* ~6 Q2 x! {+ \! s9 M

- e5 d+ \& B4 E! {. {- nOne of the most common elements of a cluster is a set of resources that needs to be located together. Start sequentially and stop in the reverse order. To simplify this configuration we support the concept of groups. The following example creates two primitives (an IP address and an e-mail resource):
3 r- o/ q8 e+ D( _& k! @3 c
5 @. ?) \! {- y! k: _1 }. C4 ?Run the crm command as system administrator. The prompt changes to crm(live).3 R/ Z& n5 D! t. q2 ~. H

& F( d$ M+ D9 A9 k4 x2 x+ bConfigure the primitives:3 J2 ~& z9 I* Y; ^3 B5 r& l
  n$ e/ T  U% e9 c/ B# k
configure
, N% `0 R1 g( }, l; q. R' i9 g) Eprimitive Public-IP ocf:heartbeat:IPaddr \. I2 j+ A; l% u0 {# f1 y
   params ip=1.2.3.4 id= Public-IP
4 @# X  o8 {/ K7 C9 i+ X" ~primitive Email systemd:postfix \
/ D' K" A$ b3 ]6 f) W  s. y2 T   params id=Email
7 @) t- q2 Z0 t; T8 y. Q  l6 G" wCOPY
0 v1 ?1 k* P# W' r9 UGroup the primitives with their relevant identifiers in the correct order:. N% \; ]$ h$ b8 ?

$ H6 \$ z  F4 x) Sgroup g-mailsvc Public-IP Email7 F) l* n$ n$ Z. P# ^3 ]
COPY& p/ H/ P' W0 j3 o8 d' ?
To change the order of a group member, use the modgroup command from the configure subcommand. Use the following commands to move the primitive Email before Public-IP. (This is just to demonstrate the feature):
+ W2 F! t2 g- D" u: u. u' N6 v& z8 I) [6 t/ r; I7 \8 w
modgroup g-mailsvc add Email before Public-IP
  v0 \" c8 D; c! PCOPY) Y# G6 j2 x% ?8 C6 W
To remove a resource from a group (for example, Email), use this command:& _1 c0 t3 A4 D. z6 d# j) [! u

! A( u+ k' M9 `+ P% d& lmodgroup g-mailsvc remove Email
7 h$ f! K# {% n. b3 h" U: w0 VCOPY: u8 [) K' ~  o( M1 O+ L% R
For an overview, refer to Section 5.3.5.1, “Groups”./ }5 A4 V1 Z5 D! R- v5 h9 L

( B0 K0 F, i$ q( `: b% X$ a7.4.11 Configuring a Clone Resource! }+ ^+ I3 m* g/ z

- R/ ]  G0 W4 dClones were initially conceived as a convenient way to start N instances of an IP resource and have them distributed throughout the cluster for load balancing. They have turned out to be useful for several other purposes, including integrating with DLM, the fencing subsystem and OCFS2. You can clone any resource, provided the resource agent supports it.
2 Y* a! F& `$ y- x& S/ x! z, M& K  q- Y8 R( J/ s
Learn more about cloned resources in Section 5.3.5.2, “Clones”.2 X& M  a( o- _. O7 k( K
' V# s0 @) l' D7 s$ E* W2 V
7.4.11.1 Creating Anonymous Clone Resources0 L( s- `" T2 q+ k1 C# W

$ _3 F3 q1 b/ |. H$ E: v* vTo create an anonymous clone resource, first create a primitive resource and then refer to it with the clone command. Do the following:
4 ~3 ]' W- G; _' K8 d
1 ]( T  ^4 O  L7 f$ g$ K# iLog in as root and start the crm interactive shell:# ]# ]0 k$ i. r6 K3 p& c/ o

; S1 K' `4 |/ }0 p& q# ?crm configure% D3 o+ Q& T( k7 C, u3 V
COPY# ]; P, l& V9 T% r; y3 a0 ?. B9 ^( d
Configure the primitive, for example:
1 n( G  @8 N- ^, R
" {2 N  N# q( m4 yprimitive Apache apache, J) |/ g% ]4 q3 |
COPY3 `5 v/ \3 d$ N+ Y6 S2 P
Clone the primitive:
7 q8 c+ J. G( i# c8 o7 v9 B8 [# Y& A: q0 a/ B. O. u! w9 `" w
clone cl-apache Apache
. u" |/ D5 \) C2 E$ Q1 k  ?; {COPY) f4 i6 J% m& f% x4 b
7.4.11.2 Creating Stateful/Multi-State Clone Resources
( B: d) p# Q, [7 G- u: R0 F4 ~3 R$ f/ x( u- \& |: i7 h
Multi-state resources are a specialization of clones. This type allows the instances to be in one of two operating modes, be it active/passive, primary/secondary, or master/slave.4 l' d/ g) Q- i+ u
  u4 }2 h4 R0 \
To create a stateful clone resource, first create a primitive resource and then the multi-state resource. The multi-state resource must support at least promote and demote operations.1 G# Y% F6 n6 \7 J, _! o

( p8 Z0 o; z2 A7 M) Y; _: m% FLog in as root and start the crm interactive shell:
7 b4 |1 X: i8 d
1 u6 i9 t5 k( n/ acrm configure$ Y$ ?" Z: N* Z; s
COPY
1 a/ R8 e- k" M& v# f' \9 u& ^% KConfigure the primitive. Change the intervals if needed:
+ y$ J. u" R" Q* `. J: y: M7 S" f8 B$ e; J
primitive my-rsc ocf:myCorp:myAppl \
+ N$ h: ~+ ]& L. t( O. c" `  t    op monitor interval=60 \
. y: K) k0 U1 D( U    op monitor interval=61 role=Master
. e9 t+ ^8 d! ^COPY
, b$ I' F( w3 e: PCreate the multi-state resource:1 p3 C1 Y& I3 a$ R/ S

4 w; A1 m; O6 s' V8 I; mms ms-rsc my-rsc$ Z9 v9 q2 w) p0 r) d
COPY# x$ @- n& x% `/ |- |2 }
7.5 Managing Cluster Resources
, u; x) A! a' B! l2 a
0 F+ n; A" Y# e: A; y$ a5 n: rApart from the possibility to configure your cluster resources, the crm tool also allows you to manage existing resources. The following subsections gives you an overview." b& U4 H3 b1 F' `5 W0 t
8 f5 D' Q3 [- H" W. H- X- q) M
7.5.1 Showing Cluster Resources
, P2 \7 K" s+ N3 p2 @" W1 ]  B; X2 c8 V5 Z7 B0 b* y
When administering a cluster the command crm configure show lists the current CIB objects like cluster configuration, global options, primitives, and others:
$ _  R* u1 K4 v- d. r2 d2 t& Y, S
( {0 O) e/ V. _( G: mcrm configure show
  B3 u) b0 G* [5 n/ hnode 178326192: alice
: w* Q; K: ]1 p9 s  T+ Xnode 178326448: bob1 {0 A. t1 v. N' X! U
primitive admin_addr IPaddr2 \  y. ]+ A* C) L7 z* _
        params ip=192.168.2.1 \
# x2 R# l2 c" s2 t2 t! ?  o( p        op monitor interval=10 timeout=20
1 V0 l3 r2 h5 ~) |, Q- \primitive stonith-sbd stonith:external/sbd \( ]. M! _: G! L
        params pcmk_delay_max=30
) e4 q+ F  D4 Nproperty cib-bootstrap-options: \
, k$ A6 _& n& `& x        have-watchdog=true \9 c, t$ W, V# f4 A
        dc-version=1.1.15-17.1-e174ec8 \" a3 C" u! G3 h* O( ?* D& I/ o$ E
        cluster-infrastructure=corosync \) d5 F0 v& F9 c8 |
        cluster-name=hacluster \6 D$ V. d" H  d7 v8 n4 X0 a+ H% [
        stonith-enabled=true \
5 z, k" X" S5 }  @) q8 K        placement-strategy=balanced \; x1 U' i* S$ f3 {9 Q9 Y0 H* e# l
        standby-mode=true- Q/ T: u/ A  a& P' ^
rsc_defaults rsc-options: \) l9 ]6 a4 N! l( S3 j
        resource-stickiness=1 \* P) i4 W+ {- w5 ^% ^) C' ~
        migration-threshold=33 S+ o, T9 e- i1 d; s+ L/ Y4 _
op_defaults op-options: \
3 [9 h! }8 r7 s/ r& U6 @2 L        timeout=600 \$ f3 a9 T  ~" H( ?! D+ H! X2 ]1 P
        record-pending=true! q7 h2 C7 u( q
COPY
( o; X  g5 x, `! b( v7 C( fIn case you have lots of resources, the output of show is too verbose. To restrict the output, use the name of the resource. For example, to list the properties of the primitive admin_addr only, append the resource name to show:  ]' F  A: o% k0 ~
6 ~+ D2 u, M" G" E/ q1 v
crm configure show admin_addr  s9 E( w; Z- c3 i4 i4 B( {
primitive admin_addr IPaddr2 \
# B) W7 g. J. V* F+ t' c( f2 L% F        params ip=192.168.2.1 \
) r! `$ _9 j1 U6 C% M. u        op monitor interval=10 timeout=20
+ m4 A" `" X) ~6 _1 kCOPY
; ~- S- j: U; yHowever, in some cases, you want to limit the output of specific resources even more. This can be achieved with filters. Filters limit the output to specific components. For example, to list the nodes only, use type:node:  Z; ?! h, N7 V  c% a

2 f- P8 L' A6 _6 I8 u: H$ gcrm configure show type:node
) f! q3 _6 M# h+ hnode 178326192: alice
0 G6 |: a) l$ e, `1 Fnode 178326448: bob/ |. T' q* d3 R+ D4 v2 ?7 W
COPY
2 J' E. a2 M" z" ~1 p* i3 oIn case you are also interested in primitives, use the or operator:( z8 V4 Q, C& ~$ P9 @; f
9 ?) a0 r/ H. c5 t4 K; P& a8 `  g
crm configure show type:node or type:primitive
) p8 }+ Z! D7 c' Wnode 178326192: alice
! v/ i! [6 `5 V7 Anode 178326448: bob( @/ F8 y6 n  W2 ^: R$ W
primitive admin_addr IPaddr2 \
' ]! i$ }. X, i  ]5 I5 f        params ip=192.168.2.1 \
: ]3 X- ~( |8 I; @' u' w- V' H5 _        op monitor interval=10 timeout=20
' h. m4 _7 T* \8 F1 V' }primitive stonith-sbd stonith:external/sbd \) C& [, Y9 L$ G+ m3 \0 ]
        params pcmk_delay_max=30& v4 y- u+ a/ f' K: |& V6 A
COPY
% ]3 T# o3 o  ~' t* Y: tFurthermore, to search for an object that starts with a certain string, use this notation:
3 N$ Q" V9 y$ }8 z
/ M5 f4 A4 |  x. hcrm configure show type:primitive and and 'admin*'1 E4 a  o8 W0 s1 \! a0 P6 v
primitive admin_addr IPaddr2 \* ]" p% X; r3 A- S% A
        params ip=192.168.2.1 \
& b3 |* }) t# p2 l* Q        op monitor interval=10 timeout=20
6 e% m5 D7 w0 Q, g$ @COPY  [- p  h# V; _+ ^- d8 V
To list all available types, enter crm configure show type: and press the →| key. The Bash completion will give you a list of all types.
% N3 T& U* Z- V" q+ g0 W8 i$ [9 Z! t
7.5.2 Starting a New Cluster Resource
7 K! o5 [/ H/ r4 G8 o. x. W& f0 l
, D4 W. O7 T8 {* B0 `9 M1 MTo start a new cluster resource you need the respective identifier. Proceed as follows:3 p: v1 H, \$ }0 J+ ], g3 C7 f

6 J8 b- z! w6 @, ~Log in as root and start the crm interactive shell:
& Y& ]  m* h1 g7 @' w7 u
' H) i" _0 ]7 |! z$ n+ Q2 c3 Xcrm" a) _1 x' y' B( {) T
COPY
6 Q+ H2 a' c+ n$ F! Q$ E" L! k; cSwitch to the resource level:# [, T  H  _" j3 l: s0 \; A
$ F, ?- x7 O/ B- }, C
resource9 G) A, B: m" @
COPY( x7 ?1 b6 v$ o* n
Start the resource with start and press the →| key to show all known resources:" C; S- z' q2 X% p- B

. i$ }# |' ~2 m3 Ystart ID
& d2 z* S- t5 y- TCOPY
0 s$ ?* ?; G$ Z( M' o7.5.3 Stopping a Cluster Resource! ^' @, x. M. s/ v
- G* E' B7 m  b! ]: K2 V
To stop one or more existing cluster resources you need the respective identifier(s). Proceed as follows:
/ v3 C3 e# d: D/ B* v! i+ d, y+ Q9 \
Log in as root and start the crm interactive shell:# Z' K  J) O* `# k: S, v; [( j
! i, [  `/ X0 J. _
crm
* ?5 N6 w' Q! h) jCOPY
. I6 }; t0 ~, R0 gSwitch to the resource level:8 b, ^' l& J( f) F
- C- H& h+ k' X8 P
resource
0 G) W' M8 _  n7 N9 GCOPY3 m8 j! S/ M. [9 ]& N  V" M
Stop the resource with stop and press the →| key to show all known resources:
1 y9 t2 M2 b/ M$ E: k: m5 G# j! Q% w& x: e, e/ S3 ?
stop ID
" o- J7 i; y3 ~3 [! ]) RCOPY
# o# ?3 [4 b; M8 P$ W. W& \3 n1 \. rIt's possible to stop multiple resources at once:
/ u  L1 R/ G9 }5 ^' H( N1 Q4 q7 C; E+ U# q" }
stop ID1 ID2 ...3 G/ v# N: p* z9 r. P
COPY3 x& Y- O$ M! A
7.5.4 Cleaning Up Resources
- j( S, I* K# }. z
. g& \' h# Z. M7 Z, _A resource will be automatically restarted if it fails, but each failure raises the resource's failcount. If a migration-threshold has been set for that resource, the node will no longer be allowed to run the resource when the number of failures has reached the migration threshold.
8 m% d6 t. P" M) P+ u6 C- _7 ]$ E2 T* U  G
Open a shell and log in as user root.
5 o( O/ E0 ]! q
) A9 a. _1 p' P& yGet a list of all your resources:
7 s. Q  b9 G7 `0 V( h1 f& c
$ k3 q7 m7 e" |3 |  @2 _% Y/ A3 Acrm resource list6 w; P. O8 Q& ~- I; f
  ...
0 f7 e! c6 A' _0 nResource Group: dlm-clvm:1! O1 A% Q  K: l. M3 @1 U
         dlm:1  (ocf:pacemaker:controld) Started
. R% A$ W& f* N* V+ [4 }3 }" u$ T         clvm:1 (ocf:heartbeat:clvm) Started
: l5 k6 R- z% o, N3 LCOPY
9 |9 S- w& j! ]  ETo clean up the resource dlm, for example:' ~" o2 K# O# j& P
! {( A! l( o, B# V. Z9 b6 n
crm resource cleanup dlm
+ U. @! G3 _! |5 p+ N. ^1 HCOPY
. g  L8 e6 R* j6 N7.5.5 Removing a Cluster Resource
0 C- H- c5 q. W+ S1 ?  ^3 l5 J5 ~1 ]+ i/ D& f8 J  `. F; |
Proceed as follows to remove a cluster resource:
; z- `( ~8 q0 M+ D; E* h
2 G, n* `4 ?9 D/ W$ mLog in as root and start the crm interactive shell:
7 H0 w, G; o. l  d  G6 g  F; R* @  O7 H5 e: J; @- z0 E: }- p
crm configure
; R# b. Q+ x4 KCOPY* \) ?  t, @7 E, o" S
Run the following command to get a list of your resources:$ L  q+ |# Q% S( F- l5 [1 U
1 \& @& U/ S* v0 q: p: B. l2 S
resource status  ]7 |# |+ w% `
COPY
! d  v4 d) X# {' {+ BFor example, the output can look like this (whereas myIP is the relevant identifier of your resource):
# o, N0 U+ q6 ?  M: p- o% F/ T+ X
; `9 p! |: \$ ]2 _8 o( f1 fmyIP    (ocf:IPaddr:heartbeat) ...
2 ]- V, N1 f8 W. Z2 L& HCOPY
2 Q% ]% N# v! l7 K  {! t( FDelete the resource with the relevant identifier (which implies a commit too):
' u4 ~2 `2 H& y6 [7 y! b5 Y1 j! K$ @: L2 f
configure delete YOUR_ID
' @6 ^) |+ F7 q* R# ~COPY1 i! a6 o1 R4 J
Commit the changes:( C0 y; z7 a1 w; D) g8 I% B/ C& i

, H) b( B. @1 o: C* |3 A+ Y6 nconfigure commit
/ {# C0 g- R" [& {COPY
$ }* s+ C$ ?0 X2 W9 ]" d+ Y; l- g7.5.6 Migrating a Cluster Resource
- l1 V- ^7 s6 d5 W
. R# J7 ~. e& HAlthough resources are configured to automatically fail over (or migrate) to other nodes of the cluster if a hardware or software failure occurs, you can also manually move a resource to another node using either Hawk2 or the command line.
8 e' Y4 O" a/ q5 \" [0 o; m
( N$ c+ P' d1 e) n5 ?" p9 vUse the migrate command for this task. For example, to migrate the resource ipaddress1 to a cluster node named bob, use these commands:
/ K( `3 ~' q  F' q& r
- b2 \! g. H9 R0 w6 w# Ucrm resource1 J8 S9 Z- M8 K; M" F* Q
migrate ipaddress1 bob
; m/ e( w9 W. m! M' DCOPY) s1 \$ f4 b+ W9 d
7.5.7 Grouping/Tagging Resources( t) [! Z& D% l1 F! J4 Z
$ w* f+ q5 n: Q& T" _
Tags are a way to refer to multiple resources at once, without creating any colocation or ordering relationship between them. This can be useful for grouping conceptually related resources. For example, if you have several resources related to a database, create a tag called databases and add all resources related to the database to this tag:
/ O2 q( F$ X, Y" a- q1 [' c7 x# S+ T8 P' }
crm configure tag databases: db1 db2 db33 T" V/ Q! D' \9 F
COPY6 q: J* {1 J; V. r, Z) D
This allows you to start them all with a single command:
6 {8 E& i! K8 y( @; R# B/ ?$ V' T. J0 X8 V5 n( }- T; f
crm resource start databases
' e" c7 W+ Z) R" U% j3 R  d$ sCOPY; E, u3 s: h2 \/ Z, Q
Similarly, you can stop them all too:3 x! E( l) o$ M0 u5 V, S

+ y; L0 J2 ?2 A6 L# c7 x8 Kcrm resource stop databases
& p2 u. o6 \, UCOPY
1 u( u4 E  z- ~6 @  b% C+ W7.5.8 Getting Health Status
5 E9 d, z- Y5 u) o* Y' n8 X
' h. w! g! B( d0 z' n' RThe “health” status of a cluster or node can be displayed with so called scripts. A script can perform different tasks—they are not targeted to health. However, for this subsection, we focus on how to get the health status.: v/ k7 X9 m) ]& X( X
0 o/ E: m, ]' l1 l
To get all the details about the health command, use describe:
6 Q! n/ l- O# @/ H- L
* T& Z4 ~" P4 N  ]' k& n# [) h7 J: e; u# Xcrm script describe health
, U2 U- W, @7 B6 Z: WCOPY
9 Y7 ]3 `/ P! T- b2 lIt shows a description and a list of all parameters and their default values. To execute a script, use run:
8 V! g5 A0 [* K6 X0 F8 ^
; q( |0 G+ R  k0 ~crm script run health, D; E) \% s, c+ R: t
COPY, x: Y, s6 W* G% I
If you prefer to run only one step from the suite, the describe command lists all available steps in the Steps category.4 i  D/ j+ h# H8 o- C

' _, r( a& V: u9 NFor example, the following command executes the first step of the health command. The output is stored in the health.json file for further investigation:
0 ^) i" W$ g' G5 e9 o, i7 d2 x5 H9 W/ W; r$ P
crm script run health
& P6 @5 D& j# t, e# K    statefile='health.json'
# c$ `% M6 N/ Y, A- UCOPY
$ X" j. `1 m. s# vIt is also possible to run the above commands with crm cluster health.4 Y  I) h0 I$ M+ n  ?9 D3 ^

: Y8 o  q7 ^+ e+ L' `For additional information regarding scripts, see http://crmsh.github.io/scripts/.1 N( f- I0 b. O6 y# e' _+ O, u
# N2 V7 `- Q7 ?8 `
7.6 Setting Passwords Independent of cib.xml5 d% b4 G' O( C, u3 W1 r

: x+ I1 U" ]7 K! FIn case your cluster configuration contains sensitive information, such as passwords, it should be stored in local files. That way, these parameters will never be logged or leaked in support reports.
0 p4 o6 ^; ]+ ~: V/ N# Z+ q& j9 b- f' t1 m: k2 E$ F- d9 P
Before using secret, better run the show command first to get an overview of all your resources:
" _, M% A: I* G1 J9 D& U" }; \% M" k# \7 I6 Y  p
crm configure show
0 Q  p4 j9 K. q9 \1 Pprimitive mydb mysql \
2 ]9 a8 G% i# M0 O  @4 I   params replication_user=admin ...
( ~* V' _8 k' ?" i! E& E6 W8 ~* lCOPY+ O5 m. |# W! I6 {
If you want to set a password for the above mydb resource, use the following commands:
8 _1 z* M1 \. R" A
, _! F. V- o% W3 w& S! vcrm resource secret mydb set passwd linux
  f' f$ a% O) p$ ?INFO: syncing /var/lib/heartbeat/lrm/secrets/mydb/passwd to [your node list]
* [" f9 s( V" f' X  M! e0 UCOPY, C5 F  ^$ p* [6 Y
You can get the saved password back with:0 `- v5 V6 B$ p. o3 u: k
3 y8 ?& _6 l3 h
crm resource secret mydb show passwd0 n# L$ G% b) b/ p/ R, p
linux
0 V1 n5 e% |, w. u6 VCOPY
( F) b' w4 g5 d% I, gNote that the parameters need to be synchronized between nodes; the crm resource secret command will take care of that. We highly recommend to only use this command to manage secret parameters.
7 Q+ W. y% i! G
2 Q! M+ y( s3 s/ n/ z' t( S; P7.7 Retrieving History Information9 r3 ~9 D2 s" o" _3 ?9 g, q" _3 a" T
+ v7 M" ^5 `: @9 i
Investigating the cluster history is a complex task. To simplify this task, crmsh contains the history command with its subcommands. It is assumed SSH is configured correctly.; \! }4 R. J- p7 u/ t0 |) F5 N8 S0 a

  o% i, D, X3 |4 tEach cluster moves states, migrates resources, or starts important processes. All these actions can be retrieved by subcommands of history.  j: Q- i. {4 L/ H" v; p& S

. D/ O' J( j8 Z/ k" W4 {( bBy default, all history commands look at the events of the last hour. To change this time frame, use the limit subcommand. The syntax is:) h; c0 t5 }, c# s& F6 \2 ]  S, s+ L5 w

( Z! x& m; C: `9 w% l& h% I1 Ucrm history1 k1 V/ D* v2 @. F3 x
limit FROM_TIME [TO_TIME]
, s0 i% H: o  R: r% Q; eCOPY
9 N  o& x# f: s$ g3 |: d2 B  r; sSome valid examples include:
) c& C/ ?' A. }
: W" d% l1 U5 u8 Vlimit4:00pm , limit16:00- d) n& u! r# `  W5 h- T
Both commands mean the same, today at 4pm.3 Z8 p5 O+ x; J
5 m4 k( A9 U7 ^$ \6 m
limit2012/01/12 6pm
' P$ j; v" P% b& K4 L: Y1 IJanuary 12th 2012 at 6pm+ t% ~0 |& M3 \
: }8 L' ]( b* R% g( w) `0 T
limit"Sun 5 20:46"
! C1 ]; m, P, [& JIn the current year of the current month at Sunday the 5th at 8:46pm0 G! k1 B/ R' K. _

9 e, a2 {7 M8 r1 MFind more examples and how to create time frames at http://labix.org/python-dateutil.
5 q2 F* ?1 r: q0 ]) Y) Z: a2 k) \2 Q* k) d: e: ~
The info subcommand shows all the parameters which are covered by the crm report:
, ^/ N4 r& E5 o  c9 p7 y- T1 ^0 g( {
. u9 u" c* Z& R: kinfo
) v# }! }+ H9 T7 u6 v  DSource: live
8 X* V) j: [+ e& U' c- hPeriod: 2012-01-12 14:10:56 - end% R, J# \% L3 R' G7 I
Nodes: alice2 R; i0 G0 q" z" f1 ]- y$ O$ B
Groups:; P; m/ P5 u( _$ H& m, ]9 [% a! Y
Resources:
( \" [0 K+ o( s. y. pCOPY
3 s$ T: q# t, `7 o* h$ uTo limit crm report to certain parameters view the available options with the subcommand help.3 ?  C: W( D! z6 ?; Q( N! J

7 I9 x" B1 _$ ^7 D8 v; y( nTo narrow down the level of detail, use the subcommand detail with a level:, `- [4 J0 l' d1 N4 l9 G

$ a8 Y# S/ H, i7 M0 C  z' {detail 1
/ U1 X( B) i% F# G+ VCOPY
& ?2 e0 @. k" z8 N; @2 w+ @The higher the number, the more detailed your report will be. Default is 0 (zero).
3 @' p+ A# i  G- `+ Y( G
' @" c- L; V! ^0 T3 {' o8 tAfter you have set above parameters, use log to show the log messages.3 r" \( l4 g; ]! T

  M0 e2 G2 ^" {8 b+ i+ yTo display the last transition, use the following command:
( j5 V, D- V- O' p/ M3 w! z* O8 `' S' W* V; J' l. R+ S1 t
transition -14 \' G9 f( y) @! p9 M
INFO: fetching new logs, please wait ...
' ]/ F/ x) s# ]/ L5 jCOPY1 l( S9 F2 A$ h% C
This command fetches the logs and runs dotty (from the graphviz package) to show the transition graph. The shell opens the log file which you can browse with the ↓ and ↑ cursor keys.5 h4 M$ l  f( y* x- @
. k9 K6 u1 I% A
If you do not want to open the transition graph, use the nograph option:: I' \+ l  _( ]5 z+ ~9 `: x

  S' F8 Q* w9 W5 P, e% A1 ttransition -1 nograph( ^- t8 x6 V' r, f
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 01:44 , Processed in 0.022091 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表