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

crm command 编辑文件 shell

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2023-12-22 11:39:28 | 显示全部楼层 |阅读模式
CRM shell / text based
/ W0 l, A8 b  A' V$ {5 k0 A( t, KThe 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.
6 x: X% j( z$ a# crm configure edit
- x+ E/ B7 I6 U1 o( R* d: j. O4 \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.  ! ^+ ?* Y) g" g2 b6 d
# crm configure edit <primitive name>5 F3 D' ]) E6 @; j! x% V
You may also choose to edit the xml version of the cib.' F$ }: K; }: b: K2 e- O
# crm configure edit xml' H% x# l6 w% E0 ]; b. K: f
As 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.  8 `& A! H/ N/ `3 b5 j; D
Additional Information
% z; p+ {4 |7 v1 AA quick text backup can be taken of your cluster configuration using the following command.* k% ?9 k' K+ {$ E. X6 |0 q8 S' z
# crm configure show > /root/cib_backup.txt
  ?% f0 M4 r1 m% i# `& CTo restore a cib from a backup file previously created.
& M. m* g- X! s: t3 M6 O1 D) L" X# crm configure load replace /root/cib_backup.txt
. y: m5 q9 p0 m# S; E) |

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2023-12-22 11:40:10 | 显示全部楼层
To output the usage of crm and its command line options:, W7 b$ J! y( J, t4 O0 s9 n
5 |0 u3 `( O9 q* C
crm --help
2 [/ X7 p# O+ HCOPY
1 I! |7 M( E3 D9 r& u% QTo give a list of all available commands:
6 w0 b' O$ W) ^! T$ w
* p4 n  o) r: s0 }/ Icrm help6 x! C9 t: A; o: P6 v% B) z
COPY
5 Y  X- _) {0 m7 e$ [" @9 X% u# |To access other help sections, not just the command reference:6 f3 G$ C8 `% Q& J

. M% _/ F8 C# M  @5 ycrm help topics  b8 z" A( v8 i( L
COPY. t, {' ]8 i+ D
To view the extensive help text of the configure subcommand:( Q  I2 ~  B- i0 o, r
) x, [" Q, |3 i
crm configure help/ F; L# B  w& Y0 ^9 v2 k; e
COPY4 l. Y0 U5 o4 [8 o9 \+ {# u- _
To print the syntax, its usage, and examples of the group subcommand of configure:* R" M4 {) w4 n& C

3 b* h* R1 D. Y: u/ n6 Hcrm configure help group; f1 a7 K7 P) ^+ s
COPY
! r0 A. t* p5 oThis is the same:& z9 o4 W. D/ ?; C) P, {0 O3 G7 G) v& [

2 t# ^( m! ?2 s+ jcrm help configure group4 S+ B" Z* w. P# Y# a+ r! `7 \5 Z; Z0 L
COPY

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2023-12-22 11:54:34 | 显示全部楼层
crm options user hacluster
! T' O( z; D9 J. |, W% Z  CCOPY
4 g3 a  I0 N0 w/ I. K7 I5 T  ~/ FNote that you need to set up /etc/sudoers so that sudo does not ask for a password.5 o! [7 j  u( w* T* I9 d4 T7 Z
( j* X2 ], L/ f# I1 `  l
7.1 crmsh—Overview. T$ x+ v3 b7 s) C. @1 z8 q
7 G' A) P# D' y
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.
) R2 ]$ P/ d8 @5 b5 N4 Q1 |9 C4 ]5 g7 {: @
TipTip: Interactive crm Prompt1 ]8 x% @! {5 x* H, a! Y
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:
, W: U$ E; O1 A
8 g8 L, Z) X7 ?9 F9 t0 [5 mCOPY
5 S: E) ]& ~' i! }# R  Y0 ~For 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:
# [" o. l9 Z+ Q  A* l, ~- q6 e* ?. n8 X) |6 j9 e
COPY# @& m( J+ j, j- u
7.1.1 Getting Help7 ?( A1 T( ]" E) W, C6 k
% g3 ^- G, E0 A) Y: M3 Q, ~  @* D- _
Help can be accessed in several ways:9 v4 f: S# Q5 T

; l* y6 K% y9 m" [! Q  m: m6 `To output the usage of crm and its command line options:8 _/ s( V2 d8 v% p+ L
" E3 B! {) P7 a: J$ C
crm --help
0 |8 h3 ]7 _0 q2 O3 P7 z* e- BCOPY0 n( m* b/ g: }6 v+ z1 s2 l
To give a list of all available commands:
; Z# w3 o5 N- [% I" T! T7 T7 Z, f9 i4 T
2 p0 ^. h! d, @; e0 B  \& y$ ycrm help  k4 ~& e) \, `; W7 R
COPY
% t& _) }  p. e7 t, |To access other help sections, not just the command reference:  `2 M9 F" I) ^) @9 G! c
$ S( g/ g' \7 c3 G$ P
crm help topics, X2 U# }. Q& R7 C9 ^3 B
COPY0 r' u1 Q  L4 }5 f# b! ~' ~
To view the extensive help text of the configure subcommand:& z3 B8 S. t4 v( C  z4 W
2 ]: e! n$ t5 M$ p+ b' b+ h9 p# j
crm configure help, m, _5 |! z$ V2 K
COPY
; ?4 ~" W  H6 x3 QTo print the syntax, its usage, and examples of the group subcommand of configure:
9 e0 J) `' D2 f( j& v# Y) ?" \. P, y' t& x4 w! v
crm configure help group
0 u: p, [+ j& G0 d# MCOPY
- U! w: w* u8 v" h( |% k0 v  L  GThis is the same:2 W6 Q$ K3 y" k' g3 s) C: n

5 S; \& b; p" n4 {, V4 m% Lcrm help configure group1 m# {1 G( C) f- O3 C" ]; J
COPY
' ^* r( L9 A3 L, n( }' VAlmost 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./ R8 t5 t/ j  r: V# N) f

: Y4 x) z7 @2 `8 D4 d5 y  LTipTip: Use Tab Completion in Bash and Interactive Shell/ i8 p7 K( Y- l6 L+ U" f
The 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.6 t, B8 c& T# U( ~, k7 I0 L/ A. r) G

6 L- v1 M2 c" F6 O  }- \7.1.2 Executing crmsh's Subcommands
3 `* _- P6 s6 I# ^: ?% z
: P8 m5 D5 f4 w6 B7 d) ]8 SThe crm command itself can be used in the following ways:
- m4 S$ l# y: ?/ @
! i  d; D5 r2 u) B5 Z3 H, y: 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).! S. b" ^" ]+ Y+ d0 I

; c/ L" E- N- J$ n8 @It 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.
! B# M! z* G& E" c
: f4 u: T$ E" @7 s' ]0 HAnother 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:8 @9 p" }9 N- o) a! g
) }+ j5 ^: E7 c! a* g% E
crm primitive ipaddr IPaddr2 params ip=192.168.0.550 `3 X* M7 l$ B$ v  `. @
COPY
3 ]7 |$ o7 K! b/ s- l- Z& zis equivalent to this line:
# g  R* A1 j: e1 U. @4 _( H! I
9 J- ?  K: C8 _& ccrm primitive ipaddr IPaddr2 ip=192.168.0.55
# E2 B' U+ \0 H4 d7 A" F- sCOPY
. i- p- Z2 q& \1 m8 {As crm Shell Script: Crm shell scripts contain subcommands of crm. For more information, see Section 7.1.4, “Using crmsh's Shell Scripts”.
( M) o, U( Z% i' K& d- g- L
% y- m7 ^  o5 ~1 ?% mAs 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.
" z6 x  F" H3 Q5 v6 o% E0 [: A3 x$ w. b: o$ l7 Z
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”./ m  l+ g; g4 e, S7 S  g; ]
) j: c5 c8 c2 H
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.- B  t6 Z8 m0 p# W+ n; k" p
' \$ b6 s3 k6 }) i3 a. t3 E. \* d
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 H( l6 k" q5 K
- n- k  n, T# MYou can enter the level directly by typing crm and the respective subcommand(s) without any options and press Enter.0 S& D3 p6 p) D6 g% ?% ~0 F" o

6 F& u+ }0 A9 BThe internal shell supports also tab completion for subcommands and resources. Type the beginning of a command, press →| and crm completes the respective object.: q& b# j! `- H
  v" I8 k4 S3 v# _' i) Z+ C
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.
' E- Y3 b6 F8 G# k. }* I3 }
# a8 _0 @1 c# BNoteNote: Differentiate Between Management and Configuration Subcommands
& O$ J0 R) U; g9 SThe crm tool has management capability (the subcommands resource and node) and can be used for configuration (cib, configure).  q; p/ g3 V( }& I: A& F9 \) m

+ i4 l" s1 n" K' GThe following subsections give you an overview of some important aspects of the crm tool.1 E; V0 ~( t3 g3 H) E3 F+ y  t! K  S

" X+ R/ V5 C# L$ r! f7.1.3 Displaying Information about OCF Resource Agents$ B1 }( G& h& k# }: U

; P7 `; w) F" C& w+ nAs 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”):
4 N/ {  E4 }% f/ z+ y* s/ q$ B5 \* H7 }3 {2 d8 P+ v4 B0 p! ^  q7 D" n
crm ra( r% c2 {7 k/ j/ C/ [' Z9 d1 s
COPY1 |  q/ [0 F: Y
The command classes lists all classes and providers:" k5 w( ?) o& \$ J% K% ]" f

) X+ b1 T' B$ |1 @classes0 H" F- M+ v+ g  E
lsb
  n* X( v! f4 K9 V+ z ocf / heartbeat linbit lvm2 ocfs2 pacemaker
8 s* w1 d9 O# D) K service- C" h' P; y. X( C& S5 @8 _
stonith9 ~& T4 t1 y, m' C
systemd% J+ Q( c- y5 g2 @3 u/ }
COPY# Z0 S5 w+ w# V( B7 t
To get an overview of all available resource agents for a class (and provider) use the list command:  {# Q4 ~2 i: @; s* R+ m4 ~. X

2 j1 G: _# x/ F" Plist ocf
' D- L) x4 Q8 @, p1 CAoEtarget           AudibleAlarm        CTDB                ClusterMon
  @4 T8 T$ U. B5 B! `6 o8 ]" CDelay               Dummy               EvmsSCC             Evmsd9 `7 H1 T" o  G4 }5 j" {6 Y
Filesystem          HealthCPU           HealthSMART         ICP
  B0 @( K8 h7 M3 TIPaddr              IPaddr2             IPsrcaddr           IPv6addr% \1 T' }5 q! v* d, `- J: C: N
LVM                 LinuxSCSI           MailTo              ManageRAID
$ a, y6 W9 a( P: R8 GManageVE            Pure-FTPd           Raid1               Route7 N4 ]9 w# u3 F
SAPDatabase         SAPInstance         SendArp             ServeRAID2 S' t9 m. Y: L
...
6 B  n2 Z! ~) k' LCOPY' N" Y. B6 e1 n2 h; N. {: u
An overview of a resource agent can be viewed with info:1 Q% p& }  T+ x1 `9 n- L7 I( q
7 @3 h2 \& Q! b3 y  ?% Y6 o1 U- U
info ocf:linbit:drbd+ A3 \4 X# A7 {
This resource agent manages a DRBD* resource: e3 p" @4 A" `0 j  L( j; ~, K
as a master/slave resource. DRBD is a shared-nothing replicated storage
' ^: Z& l8 o0 }5 W  Q1 a) L5 tdevice. (ocf:linbit:drbd)6 L* s7 Q; Z+ Z3 V* J3 y5 s! f5 Q
  p# f" `- j- H1 ]" W) z1 ~1 O
Master/Slave OCF Resource Agent for DRBD
0 K+ t5 R/ b3 N9 P' O( ]
6 R' F  A4 H( e' L3 B* I" FParameters (* denotes required, [] the default):
! K5 |! p% Z7 l& ]8 N  w: m$ b0 f- R$ d: o0 \% j; _& u) \8 q7 T, i
drbd_resource* (string): drbd resource name
. e7 @9 |2 s# r0 J% C: t' a    The name of the drbd resource from the drbd.conf file.
: Z( m  I& F6 z( z. P9 U7 W7 c! X9 t% r+ D6 B6 m
drbdconf (string, [/etc/drbd.conf]): Path to drbd.conf
* y5 d; m2 @) j5 p( d; r8 R( `; \    Full path to the drbd.conf file.
+ |! B8 v9 ]3 a$ n0 H, n" f  u" c/ r) G( l3 E" P
Operations' defaults (advisory minimum):; t$ A% |  K( F5 B
5 L+ j' A6 j- m1 o9 Y: n
    start         timeout=240% @  Z& H- p. W0 ~3 R! i" }
    promote       timeout=90
/ F$ c, g( I, P, g/ J    demote        timeout=90
8 w0 _8 q" C- e, p% b0 ]    notify        timeout=90
; K6 N; C0 R% ~/ Q    stop          timeout=100
/ ~9 M0 B) P6 n    monitor_Slave_0 interval=20 timeout=20 start-delay=1m
6 h' |4 k$ @" k% {% T    monitor_Master_0 interval=10 timeout=20 start-delay=1m
9 ^# b2 ~& U& |6 sCOPY
/ x7 M) ?$ \9 }- ]Leave the viewer by pressing Q.
. A# C+ P- q5 ^- V( a3 r; D0 h) T. B, W9 V* ]  i: e" f7 U  E! m
TipTip: Use crm Directly+ n7 |8 F8 I! I& A
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.- _/ c- p. G3 @
! O) a0 F, e5 w. n
7.1.4 Using crmsh's Shell Scripts7 l7 `( M1 _1 j6 z5 \  z8 p8 ^
( g2 M0 j, x/ v. @- c6 W3 e
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.
* P/ e$ f/ R# c) }) u
# u; r  C: J" y  X$ `! C( w! lBefore 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:
" P7 e* }; Q; \7 b7 g" E7 J
  f/ Y5 A1 M& o: l# iEXAMPLE 7.1: A SIMPLE CRMSH SHELL SCRIPT
3 z6 Q0 V+ C$ B3 `8 d; ^1 j9 k! F! O& L; B, r' ?# b, q2 l
# A small example file with some crm subcommands
' Y8 j- Z4 g3 p, @+ `: M* _: Ystatus
( c  c" t, U1 m% G1 pnode list5 t! V/ N% I5 R) m9 ?4 M  E' G3 |
COPY
2 O7 d9 b9 b0 K. YAny 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.8 G* `& J3 a8 ^" O3 l  k8 w

7 L5 X% Z) I+ ~& gTo use this script, use one of the following methods:
2 s; T" m- e1 G4 w
' f3 u( v9 z2 b: }crm -f example.cli8 H6 y$ Z7 c+ g3 @, `8 D/ m& o
crm < example.cli4 l+ }8 g$ u, j3 W
COPY
9 k9 z3 v% H$ k" l1 V2 I2 M7.1.5 Using crmsh's Cluster Scripts
# |# d7 i+ \6 V2 m+ ]9 D. B4 F5 T0 C. i% Z% O2 k
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./ x5 ~; v. |* ~3 @' Q" h3 u
6 ~2 _- [' I8 Y$ H
Do not confuse them with the crmsh shell scripts, which are explained in Section 7.1.4, “Using crmsh's Shell Scripts”.1 Q! Q- O% z% |' z/ \

% G# t( N8 S' Z  t( aIn contrast to crmsh shell scripts, cluster scripts performs additional tasks like:: C. Y* L3 x6 F' o1 x% \9 s
, F/ t! h! t5 w- B
Installing software that is required for a specific task.7 ^9 s& L3 Z( R0 O" D

; b  ~3 D7 s9 W, T: x4 t8 ~, hCreating or modifying any configuration files.1 ?5 T4 T) {; L/ e0 k

4 V. _) l+ K( d; G, xCollecting information and reporting potential problems with the cluster.. }; G  a, ^! q5 L* a, e

7 n# @2 p3 C3 {' a' G% dDeploying the changes to all nodes.
1 p- d& S3 h% b; g
- z; v6 {7 a; w: l* f# z: f% U" n7 hcrmsh 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/.
6 [9 q+ f- S9 `9 [% @4 ^7 x
# t4 Z2 f- e0 c) y7.1.5.1 Usage. [/ J2 {/ K( j& r

6 L: k+ {0 R. c* @; M7 t& }# ?To get a list of all available cluster scripts, run:7 }3 ~* v8 S, {3 ?7 V
2 R% O! j% m4 \& W  Z7 E
crm script list
6 J! t9 n# S! T' kCOPY
0 V, N8 Y: Z$ C9 u' wTo view the components of a script, use the show command and the name of the cluster script, for example:
, _, D2 V, K3 k9 d" ~8 E4 \! `, k+ A+ Y* }- x6 ]
crm script show mailto
* k  w+ Q! }2 ?0 Y$ j* {! z6 jmailto (Basic)1 G. T% E& m* s
MailTo# p# s6 |: G' l* ?8 `1 [; [
  U& O0 e- L7 D7 P8 f* L% p: Q
This is a resource agent for MailTo. It sends email to a sysadmin3 M1 K- }8 C( x* `1 H1 r
whenever  a takeover occurs." z" X6 R; a% d1 p0 P4 Z
  r+ E* ^0 U- K) I+ ?
1. Notifies recipients by email in the event of resource takeover
( F# |5 p- U. Y* M; L! q* I& y( E1 B' x* l2 A* v% Z( ?
  id (required)  (unique)3 l3 b5 {3 V8 Q/ X6 \
      Identifier for the cluster resource. G" ~, X* u1 ?' x$ Y1 b
  email (required)
. h$ M/ B0 ^& B0 D# X: w. [, ]      Email address! D  p! n( ]% j" S' Q
  subject
: {2 z2 O: u0 d% j      Subject3 \$ s6 f6 M; r7 _$ C
COPY
+ l- W+ M1 S: @  X) _The 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 V, P- q% e( A) N( h; Q* d
9 o1 ~! s1 m; S% o4 N) @. V
Each step contains a list of required and optional parameters, along with a short description and its default value.: b$ j+ L# [* d+ I' V
/ U/ z1 b" A6 C1 O% q( {; G
Each cluster script understands a set of common parameters. These parameters can be passed to any script:6 f/ Z3 B& e1 Z& V: V

0 l$ s8 N$ r) ^0 a+ Q2 [TABLE 7.1: COMMON PARAMETERS
5 L5 M$ M! B: u! R8 A" ?$ B" I9 P: @6 c) `2 ]" W
Parameter        Argument        Description
& l) [+ y7 r+ r' t3 faction        INDEX        If set, only execute a single action (index, as returned by verify)2 Q9 @* a. z8 m$ G# h" }4 P
dry_run        BOOL        If set, simulate execution only (default: no)
+ G, ]  N1 s9 ?! h/ c: {. Z+ bnodes        LIST        List of nodes to execute the script for. H, E- u# x- l& K; N
port        NUMBER        Port to connect to# M6 v& R! {$ T; h, T7 `- @/ k
statefile        FILE        When single-stepping, the state is saved in the given file' b! q. b6 |0 @& \( y% G0 q
sudo        BOOL        If set, crm will prompt for a sudo password and use sudo where appropriate (default: no)
: i2 r5 E1 }1 L* K5 Q3 ytimeout        NUMBER        Execution timeout in seconds (default: 600)
" ^+ Y$ T4 ~4 H' W' w( suser        USER        Run script as the given user
7 A2 c- g# y7 v2 |7.1.5.2 Verifying and Running a Cluster Script
7 Q" i2 W# Z6 ^( Y: e3 q9 V9 M5 n8 t- c& B/ G* t
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.# R: {; O& d1 x1 l
% [/ d7 m3 u4 O+ A) b: v2 [8 r1 M
For example, the mailto resource agent requires a unique identifier and an e-mail address. To verify these parameters, run:  z; }- t2 w- \# W! j3 e

& k( W0 Z8 W, K4 N+ j# r. Bcrm script verify mailto id=sysadmin email=tux@example.org
9 b& v+ ^( q! n( @7 e' ^1. Ensure mail package is installed
# a& y2 d, P* r1 c5 G* J; ^( T
9 Z  `( P- M8 ]; d; @        mailx& m( h3 d3 v4 D% s* d0 ~; t
8 A/ x! V' [( Z4 v( f+ j
2. Configure cluster resources/ j' ^  }  j$ ]( |0 J1 ]
8 L3 M2 x  B! ^" f
        primitive sysadmin MailTo
. S: L& i4 X# ~$ Y% n" W! {                email="tux@example.org"
4 X$ `2 f2 P: r* M/ v: k                op start timeout="10"
8 y3 {( [' t1 O" k                op stop timeout="10"/ L+ l- p$ k  D
                op monitor interval="10" timeout="10"
8 F0 I5 Z" l# s
: d2 W! c9 \9 v, u" j' V' R        clone c-sysadmin sysadmin0 F7 T" d: Y4 R1 @
COPY+ U6 h0 Q4 _3 @: k7 l* d
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:2 E0 n/ _0 A8 m& u3 t

5 Y* g7 u$ B  B: P0 s( hcrm script run mailto id=sysadmin email=tux@example.org
) O0 B6 Z2 N+ b$ z/ `8 d4 @INFO: MailTo, i) I; i4 a, Z. m2 {9 P9 r
INFO: Nodes: alice, bob* a0 Y' |1 m5 D6 J5 J
OK: Ensure mail package is installed! K/ ~5 ]; ?1 _3 T' `' T0 ]: Y8 r
OK: Configure cluster resources
4 S3 J( V( @: U2 Q  E# j0 p9 V0 KCOPY# {: u5 M4 `: g1 o: B3 `
Check whether your resource is integrated into your cluster with crm status:
4 e) w2 m) c1 G; d# y* |" n2 X. Y9 ]5 @  c- w$ y7 y
crm status$ B8 n7 g+ G# [' m& c# o8 t. {
[...]. m( D0 `; p1 u
Clone Set: c-sysadmin [sysadmin]
3 ]8 k; y7 r* |0 Z+ [: e     Started: [ alice bob ]
0 P& P. N6 x( n9 u8 e4 ICOPY3 {" b# a; X5 d0 ^2 C9 ~
7.1.6 Using Configuration Templates
! E6 q: }5 j( D* i& s  k% K; W7 V! b( x. D3 z$ X! v
NoteNote: Deprecation Notice) w7 T1 Q( {4 u2 F( n# F: `
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”.
' \+ }* w2 O: k
/ c# w7 u' {- I7 Y  W$ O0 ?Configuration 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.
. U" S. R2 B- I5 w/ q5 O% F/ W) P) q9 \6 ?* S2 F& z+ w
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.
' v/ n( n6 X2 j- T6 x  K2 a  n; m/ [3 b1 w# m
The following procedure shows how to create a simple yet functional Apache configuration:/ h- Z% s( H2 }. N
& t0 Q* _. c% b' h! Z
Log in as root and start the crm interactive shell:$ ]9 U+ {1 j3 d' U) X; _6 V

: R/ B% b/ H5 {' y2 m8 Icrm configure
7 f" P& F  y9 r. V7 cCOPY
6 \- H# S$ O2 l+ o  q. V: nCreate a new configuration from a configuration template:
$ P& v8 R: [" h. N* ]/ c: D- e6 r8 [) k4 K
Switch to the template subcommand:
6 i* V$ O: i) ~  ]3 Y3 l) ~6 K( t$ t2 y) J" A  A: ]  A5 N
template
. C, H, V0 e+ g" m% w3 _/ GCOPY* k& U, d3 O1 ]4 `8 B
List the available configuration templates:8 n  S  ~+ F; c/ q' y: E9 L& Q
! F$ t* q, X# a8 D: I2 D
list templates4 y) l5 T) d0 h8 m( {; t- p
gfs2-base   filesystem  virtual-ip  apache   clvm     ocfs2    gfs2( B4 l) h9 d4 w, Q. R. |
COPY4 ^# z4 W0 |6 [
Decide which configuration template you need. As we need an Apache configuration, we select the apache template and name it g-intranet:! r6 l9 Y1 Q6 f  P! K
5 f& N, e" |0 _3 k  ^
new g-intranet apache
" {1 ~2 |: z/ AINFO: pulling in template apache
, U  ?8 O3 B3 e" i4 ^INFO: pulling in template virtual-ip
0 j& @) p2 `/ N! q% ]" nCOPY5 a6 h: y, C+ L+ E
Define your parameters:( i/ U8 |/ V2 X0 L& T
  ^2 _( D. v4 _5 X- ~1 z7 f  `  [# n
List the configuration you have created:
4 K: W  M5 ]+ ^0 }7 I* w, w3 o% \' Y4 X/ L- {( w! K6 }
list2 p3 Z& `. y: _# d1 i
g-intranet
0 l) B/ a5 J1 J0 H; a+ v- Z8 TCOPY$ L3 |3 |& U/ P8 e
Display the minimum required changes that need to be filled out by you:
& u7 p7 _1 H7 i% ]3 R$ u" E) L
3 o; j' Q# |1 c/ g  z% n1 a( d7 ~show
; d. ~6 a6 L8 k6 B& [ERROR: 23: required parameter ip not set
$ e( Q/ c+ a/ j' K4 n& j1 ^ERROR: 61: required parameter id not set4 }* K. \4 n0 Z/ G% m% F
ERROR: 65: required parameter configfile not set
% P- F$ M. r6 i1 H+ a  }5 dCOPY
; ^( D3 o) ]0 Y+ j7 wInvoke your preferred text editor and fill out all lines that have been displayed as errors in Step 3.b:' n0 b% g' X" Z! g7 m8 u
4 d+ \/ D# N2 w) {# v
edit
9 g4 V* S( j$ TCOPY2 `1 G* @% M6 ^
Show the configuration and check whether it is valid (bold text depends on the configuration you have entered in Step 3.c):$ X1 P1 x: P, H

1 f" o9 l! }. [show
: x7 K2 d2 B: s" ~) bprimitive virtual-ip ocf:heartbeat:IPaddr \
8 O+ v+ D! R9 h+ G# h! e" ~9 }    params ip="192.168.1.101"
- m& y# g' }6 c+ I; sprimitive apache apache \
7 z% f2 a! @+ a% c% O4 T/ m1 x    params configfile="/etc/apache2/httpd.conf"
; G# j' a, ?: k2 X- h    monitor apache 120s:60s
6 [% j; L- ~- n/ Y; Sgroup g-intranet \
/ b. F/ \( h+ n% d, y    apache virtual-ip
$ I0 A9 Z: q# oCOPY0 V* e: Z! j$ ~# @5 L( t
Apply the configuration:
/ D9 |. |& z  P) H- j/ o# c1 Y/ B. H. w
apply- I7 j) f, i: ]9 d5 @. W
cd ..
" Q- D9 ]6 c8 b4 H4 c2 sshow# h! A- e% X+ X5 k# L
COPY
5 |) B- Z& b; b0 O" K( Q5 WSubmit your changes to the CIB:
" B. p5 l1 Y5 t' O0 R' ?' A0 @( m  Z7 r$ a7 ]7 h# y3 c3 ?- y8 N/ W
commit
- d' X! l' Z, x) mCOPY
$ j( K# S- o9 \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:& `! Q6 S6 `7 i( S$ n4 B6 c2 I
% u0 E9 M- x) o  v. i- a
crm configure template \- j# q; H5 S3 _
   new g-intranet apache params \! Z% O2 c* g% c, p7 N& R" m9 t) h
   configfile="/etc/apache2/httpd.conf" ip="192.168.1.101"$ W+ K0 }9 H& Z/ o* v. I
COPY
: E9 c. D$ Y$ }9 j/ j1 yIf you are inside your internal crm shell, use the following command:( M7 @3 j+ T9 z" \
5 i$ ?* [9 W4 c7 i, [- D) R9 R
new intranet apache params \/ _) \; z2 [/ [- N
   configfile="/etc/apache2/httpd.conf" ip="192.168.1.101"
; V  _; j) w1 {+ BCOPY
' f  d, d! f' d1 U8 }However, the previous command only creates its configuration from the configuration template. It does not apply nor commit it to the CIB.
) R& z% U0 z/ }0 x, I
( [  ?. |9 W- m9 f6 b9 a9 g7.1.7 Testing with Shadow Configuration
: a  B: e" t+ E0 I: U
' p$ R- W4 j1 n, P4 VA 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.& ~5 G" s2 z# O4 g3 d& s
5 ]% F; N* |: S
The usual process looks like this:0 ]1 E( b3 f. G* u; l) \* T8 n
7 v# J" P. T( H1 F0 r# M4 j
Log in as root and start the crm interactive shell:
% r. o! M/ S  o* t* o
6 c* S3 l1 }, K2 O! l) mcrm configure
, _0 c/ r+ @  }$ uCOPY
5 x5 @" ?( e3 j3 BCreate a new shadow configuration:
& B. J$ R1 H; n% a7 o, j# s2 b$ R# e; [* K
cib new myNewConfig, D. u, n. M, i4 e
INFO: myNewConfig shadow CIB created
1 R6 A2 B" u% s" XCOPY: ?# Z" j8 G- Q
If you omit the name of the shadow CIB, a temporary name @tmp@ is created.
8 V0 ?6 C6 |' m* _# t/ R* n1 g
3 I# R$ Z  w8 m! E1 SIf you want to copy the current live configuration into your shadow configuration, use the following command, otherwise skip this step:
* p/ A/ v) J  }2 [* P- ^$ h( M, W
8 f: o* e$ B3 J- `5 ucrm(myNewConfig)# cib reset myNewConfig' u  K* _! O& t
COPY
6 `7 M) i( Q5 w3 F: n, rThe previous command makes it easier to modify any existing resources later.% t" t* N: S5 j4 J$ U

$ w5 C0 u; J6 [0 p* CMake your changes as usual. After you have created the shadow configuration, all changes go there. To save all your changes, use the following command:
5 J7 t2 z/ U; m8 O* F# N! r0 a" V
crm(myNewConfig)# commit
" z8 x/ C0 V/ T" P- wCOPY
6 d- v; @& l2 Y. R9 YIf you need the live cluster configuration again, switch back with the following command:" A* \, ]5 t" {4 u8 a8 A
4 B0 A. t6 k+ y  _& V
crm(myNewConfig)configure# cib use live
7 X+ q, c' e1 Q& M. U1 |( b+ C3 pCOPY
; g" X8 T5 l, r+ o9 K7.1.8 Debugging Your Configuration Changes4 H0 J; W2 d+ v
+ B0 r& m* e: M
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:
+ a. h0 a! ^$ I3 o) W  O9 \; M* O4 J% A- o
crm configure- m! t3 h. X) ^1 Y
show fence-bob( X1 c0 I  i* q% [! i
primitive fence-bob stonith:apcsmart \$ G) k& c' m" `& b- v
        params hostlist="bob"% w/ `' j/ |: y7 j# t
monitor fence-bob 120m:60s. s  ~. E4 f# T% ?' r; s3 f
show changed
$ _% e& v5 \3 A6 E: N" aprimitive fence-bob stonith:apcsmart \7 ~* R* Y. i9 u' j1 k
        params hostlist="bob" \
7 |8 I' S3 T) D7 p3 J9 D) G( H        op monitor interval="120m" timeout="60s"+ d  w/ C! K6 G* M8 B
ptest/ {' s/ P$ b8 Z- m( [- I1 _7 i& G
commit- [, d8 A/ F% _, K7 H; b: k! f* i
COPY6 m% m6 |$ {' X& b& s$ h* ^
7.1.9 Cluster Diagram: n0 `+ ^; v7 j8 m8 O

$ Q1 C1 ^3 r, U& h, U5 _; {9 PTo output a cluster diagram, use the command crm configure graph. It displays the current configuration on its current window, therefore requiring X11.  U# \9 e: \, T0 |- R

5 n; m' i- j+ l% h# F% }  XIf you prefer Scalable Vector Graphics (SVG), use the following command:
4 z( V' m# y( V+ H
  `. h2 I1 a; n3 d1 H" \crm configure graph dot config.svg svg' E" K% [4 H- M. T
COPY
  M3 i  e% c6 s, y4 e7 W" |9 T2 h7.2 Managing Corosync Configuration
0 N$ m0 [# n# J' U
3 K! R& _9 m2 x# b; ^4 {Corosync is the underlying messaging layer for most HA clusters. The corosync subcommand provides commands for editing and managing the Corosync configuration.
& A* G! a# k3 x9 |2 v4 F
# |; `" }& k; r1 J* b, F  BFor example, to list the status of the cluster, use status:
. ?! [* V6 M% k' ?4 g
+ b7 o* R, G/ h" Y0 _crm corosync status7 m* N- a/ F& n
Printing ring status.
& J. G9 t6 Z0 m# `& E4 a. MLocal node ID 175704363
) p  `) X5 m9 v; r+ T9 FRING ID 0/ d# y  @3 t0 M( m* B; S/ @7 W
        id      = 10.121.9.43; m6 s" r: l7 [1 a8 N6 J
        status  = ring 0 active with no faults
4 A+ x9 u8 B+ e8 `' ^1 ZQuorum information
% u2 f6 n- _# ]* t7 q" K2 U( S------------------  @, s5 b$ L% E6 J" [. N& s$ F
Date:             Thu May  8 16:41:56 2014
4 g  L0 y" _, d2 u9 s6 o( WQuorum provider:  corosync_votequorum
: ]; T7 o" {- W, I7 w" t, ^  _Nodes:            2
$ i: K! T6 y+ yNode ID:          175704363( t+ e7 w4 L. |) ^& x( y
Ring ID:          4032; O/ C# P# |+ {% L  @3 w
Quorate:          Yes
( r! O. E& Q' w" W: J6 n8 a+ g" Y/ t* [2 p1 F
Votequorum information
0 ~% e1 d$ ?9 Q! c----------------------
% P8 w5 c* e3 |% QExpected votes:   25 K, a* A) S1 {5 Q3 a
Highest expected: 2' N% n! b7 k- F* q' T2 ?
Total votes:      2
+ O$ P7 \) C; l( r' DQuorum:           2
' O7 R" O$ \* e7 d# B* ]Flags:            Quorate
7 k9 S# p8 b5 x& i( V7 H) v: {; b( y& T! i7 P$ g
Membership information) n5 J5 q0 H1 ?* z* k
----------------------$ T0 X. R; y; J% ~. q
    Nodeid      Votes Name/ `( C7 i* b5 S3 B4 n9 A
175704363          1 alice.example.com (local)4 S  l3 c$ N5 t2 H$ ]% Z$ x- E% {
175704619          1 bob.example.com4 W/ X$ A  A+ r3 y9 w
COPY
/ }  M  L& X4 M% ~The diff command is very helpful: It compares the Corosync configuration on all nodes (if not stated otherwise) and prints the difference between:! I9 ]% Y5 {& e& t: l# {+ J0 r* B

9 L9 `1 q/ T8 P& W% A& gcrm corosync diff
  S: b% Z+ |1 a--- bob4 z  {4 N3 c1 j+ e- y$ c3 |- }+ ?
+++ alice
4 D$ p' a) ~9 I3 |& X! I@@ -46,2 +46,2 @@
" a, x- L( q: m5 B* g4 k. \/ z-       expected_votes: 2
6 x! l5 q  A! Y7 x- p6 P( w6 S, d6 [-       two_node: 1
& S9 Q2 _$ I# E) F: l+       expected_votes: 1
/ P8 m/ \9 T7 l4 Y0 {( `+       two_node: 0; M8 l% |/ a0 Z1 ]
COPY
$ y  M6 y: a8 V& F* @For more details, see http://crmsh.nongnu.org/crm.8.html#cmdhelp_corosync., u& |% L3 V; P, ^( ^3 p5 l

2 S$ K; O' c; ?7 E) I6 l- W  w7.3 Configuring Global Cluster Options
% C' i, E% F* H" S8 Y* _
" \; _- [9 ~' M) S2 q. I! Z& qGlobal 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:
/ |. M) k" E, B- y2 n* K$ z. d9 q) `6 v" g
PROCEDURE 7.1: MODIFYING GLOBAL CLUSTER OPTIONS WITH crm
9 |; Z- U+ ?1 ]7 S' D
/ n2 |- r$ I/ c$ RLog in as root and start the crm tool:& ^2 J* `6 x+ d8 G/ c2 V9 m" d
! p% y) g* k+ y# o2 b1 F- {% z+ d% L
crm configure* C0 y; N( P( Z% k
COPY
8 M4 }5 J/ T# l; \; t7 VUse the following commands to set the options for two-node clusters only:& g0 ]/ F& G# `' S0 Z: q2 ^

" m- n' {. S2 m, q, O: Dproperty no-quorum-policy=stop" m- {1 P4 s' K% H
property stonith-enabled=true
7 s( R( ?8 q6 \: H. d9 s8 LCOPY- {- y7 b7 U" B% F7 U/ p0 d) o$ {
ImportantImportant: No Support Without STONITH/ N/ d; m/ [1 w. K, R4 d
A cluster without STONITH is not supported.
! K/ W' N& I$ Y0 a" p' F2 z% Q2 |( U
Show your changes:( g7 u" K$ X: x! i
0 z# u  q0 T+ Z. L7 B! l, d
show' t. r3 w' h6 ^* d4 @
property $id="cib-bootstrap-options" \0 b4 l3 Z8 u6 `* N& z* g
   dc-version="1.1.1-530add2a3721a0ecccb24660a97dbfdaa3e68f51" \# Q. @7 Y2 w% {3 W$ L, t. T
   cluster-infrastructure="corosync" \
2 o9 E3 ]( a1 D* O: k   expected-quorum-votes="2" \; t6 P7 [0 r. I$ M" A
   no-quorum-policy="stop" \: \3 {' ]) w3 l
   stonith-enabled="true"
" P) K; c# e6 o6 ~9 m  DCOPY
' ^6 w0 G* U: W3 o" QCommit your changes and exit:' P  c0 x4 A+ B6 @

: Q, Y/ E9 v. U/ a+ d* ~% J6 _8 z3 Ncommit
& ?1 }( Y- I9 H- J$ R& p4 T1 O% qexit
4 `* p8 E0 A. s' E' B* Q/ X6 }COPY0 B. o0 U* d5 q# ?; X
7.4 Configuring Cluster Resources
3 ]3 J7 M. }$ @4 b  k& K, E; |( f  x1 A" V$ O
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.' l' f1 `0 F' m2 u2 K1 R' [( ~! g
5 O! S7 c7 D" ~! T4 v3 I# N
For an overview of resource types you can create, refer to Section 5.3.3, “Types of Resources”.% ~. [" [& T! t; c+ v  A8 j# K

! \) W% Y+ v) o$ v3 c4 R% \7.4.1 Loading Cluster Resources from a File
; t+ n* q$ a; d9 r- x4 q8 v$ a( X/ v+ L: U, ?$ W# e  u
Parts or all of the configuration can be loaded from a local file or a network URL. Three different methods can be defined:5 O9 J) F2 Z, [! g

1 p+ o" w- l: j" }* D8 r" T) R9 S% nreplace1 |  g4 f8 Y1 g2 h
This option replaces the current configuration with the new source configuration.0 ?5 }, e7 _% n

% s" J/ U9 P; F: i+ @2 ^- lupdate
/ G+ q* c. o0 q2 S; AThis option tries to import the source configuration. It adds new items or updates existing items to the current configuration.' z5 ]$ T+ J5 S; x2 e

6 G, |! k% A  m$ N( o2 i( Z  Tpush
, T) h/ i( Z4 x1 f; bThis 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.
  `! E5 ^1 p! |* y) d- F* F% t
7 v+ u1 f" N- ]$ W% a& R. qTo load the new configuration from the file mycluster-config.txt use the following syntax:  m4 J! \; U, S# y
4 d* i! n, d7 T0 m
crm configure load push mycluster-config.txt
' B! c3 V0 A/ J/ H& M, HCOPY
) j1 F6 T2 x8 h) l7.4.2 Creating Cluster Resources
; i( Y- X" z: N, \
6 }) Z* K: m+ S8 B* Q8 ]& ZThere 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:
% G: e  m4 }$ ]! v) G
9 n# d7 g4 O. G  O5 X7 ]Log in as root and start the crm tool:
2 l! _- R3 o- c/ K* p, R# S5 j2 u; C
crm configure
3 @4 m, v3 j8 r; T  O& e1 uCOPY8 Z5 h. v0 Z( H
Configure a primitive IP address:
7 Z# N! T* w4 [4 ?+ I
, x, K% K' S# D( \! yprimitive myIP IPaddr \
: Q  @) I& n" \! p     params ip=127.0.0.99 op monitor interval=60s8 I4 m; {6 H% O" c
COPY
6 u7 l. N4 ^. wThe 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.
& g0 Z* z2 ~' D& D+ w, m; Y
4 V/ r8 h  x& N9 T9 y1 S2 vDisplay and review the changes you have made:" ]! l; X% s8 C6 p) a0 h

' w& X/ m7 B& ]+ C5 @, jshow
0 o$ @5 I8 _2 n) `0 gCOPY5 ]% O+ s6 L8 z
Commit your changes to take effect:( V5 f: t  k' h5 Z! Y+ t6 r

( H0 @* e' V: r$ Qcommit
* _# c" H2 Q6 {- Y9 a7 vCOPY
- k# Y" l. X: |7.4.3 Creating Resource Templates
" ]* p) e( N$ v8 `' j3 C  B' J1 f  N4 N3 \& y/ V/ i
If 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:/ E3 X4 h9 q& P' @" _) h$ i. h/ o
2 V+ H+ l" W/ q" A
crm configure rsc_template
- |! u$ T+ ?! Y- g* S& Qusage: rsc_template <name> [<class>:[<provider>:]]<type>
% Z4 D" i( F. H7 d        [params <param>=<value> [<param>=<value>...]]' [8 P9 L# U8 N, x. F
        [meta <attribute>=<value> [<attribute>=<value>...]]0 U7 |) W% v1 e: {# i5 a8 z
        [utilization <attribute>=<value> [<attribute>=<value>...]]
" ^! y: o/ c! u8 S' v) H+ F0 U        [operations id_spec
/ {$ x" J. C3 Q. k            [op op_type [<attribute>=<value>...] ...]]
" a  t4 V" G3 a5 Z1 nCOPY
$ z8 N# c! v' _# j* IFor 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:
  P. B+ ?+ P8 L4 [' X
0 d0 A' E( ^, b, C: t& V( ursc_template BigVM ocf:heartbeat:Xen \
5 o( {3 D- z. _   params allow_mem_management="true" \
9 s6 R) W0 ]+ T4 q   op monitor timeout=60s interval=15s \
! j8 v* C7 b" ], B   op stop timeout=10m \
& q+ o$ s+ B+ f2 h: D/ V   op start timeout=10m0 f' J" T1 Q7 v* _, y
COPY
$ }+ _2 l7 s# eOnce 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:6 Z. K6 E. l; t+ \$ i0 C( A% b1 X

- D6 e2 Y* l) k% g- z. C8 _primitive MyVM1 @BigVM \
, L, E: A6 `8 S' g   params xmfile="/etc/xen/shared-vm/MyVM1" name="MyVM1"1 ?' b$ X7 d6 a
COPY
9 ^3 j$ Z9 ?9 a; M: sThe new primitive MyVM1 is going to inherit everything from the BigVM resource templates. For example, the equivalent of the above two would be:
, j% a0 N5 s8 ?% D
: d0 z1 k4 E4 G+ l# {primitive MyVM1 Xen \
+ Q  V, F. D( v   params xmfile="/etc/xen/shared-vm/MyVM1" name="MyVM1" \  W) v5 H  z6 N! F: k1 f/ Q
   params allow_mem_management="true" \+ s8 G( K9 P( y9 `! c* e+ A
   op monitor timeout=60s interval=15s \
  Z0 Y+ |! o' a) N+ ]   op stop timeout=10m \( R) I3 E1 \0 ^* j
   op start timeout=10m- C) U  A5 y8 x+ f' [& w' e: e. \
COPY  C4 K3 y' K; J, m% q
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:
, Y6 U4 `! ?1 ]; R; N3 F/ U/ g! Z) t0 O) s( ]3 I1 r
primitive MyVM2 @BigVM \
5 K9 K$ \/ U0 U   params xmfile="/etc/xen/shared-vm/MyVM2" name="MyVM2" \* ?4 H0 t4 R+ w% h1 W9 F
   op monitor timeout=120s interval=30s
9 n; [# y7 E, ]0 K: k/ JCOPY+ o, B+ {+ |# a% v: Z
A 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.8 O* e0 m; `1 z, ~

# s  P* k5 y- ^7.4.4 Creating a STONITH Resource1 a7 T: q+ X: Z% k2 z2 G

8 w4 \/ `2 ?6 o' jFrom the crm perspective, a STONITH device is just another resource. To create a STONITH resource, proceed as follows:  a7 |9 V' i! G, ^) T: R! i0 q

; T7 M/ m7 d/ l" E6 ]) q. P; pLog in as root and start the crm interactive shell:
; |/ D6 @  p0 N9 l0 [3 m& {" `7 P" E7 X0 _; i7 e5 Y- J+ y
crm configure, I1 s; r7 \+ E
COPY
0 `- u) y; H# K5 sGet a list of all STONITH types with the following command:. l0 N% W* Y# @7 B4 e1 Z% b5 U. y
3 ~0 M( B! G1 v4 \8 c& M
ra list stonith
4 |+ U9 V/ p" _- R5 Eapcmaster                  apcmastersnmp              apcsmart" ~- |8 Z7 q/ [
baytech                    bladehpi                   cyclades" H) p$ V# ^& l
drac3                      external/drac5             external/dracmc-telnet
* K! B7 _! I& o9 @( @' {" r  i; z2 gexternal/hetzner           external/hmchttp           external/ibmrsa2 m: Q7 X  m- Q0 z8 z7 a! W
external/ibmrsa-telnet     external/ipmi              external/ippower9258
7 L! x- a( C$ U$ Z4 ^( g6 m& U- s8 P% {external/kdumpcheck        external/libvirt           external/nut1 t' ~- [9 j* B' D1 V6 j7 a  X
external/rackpdu           external/riloe             external/sbd
; s# B" e' R' |& J0 bexternal/vcenter           external/vmware            external/xen0
! J4 @% W! v% k( [) l* D& dexternal/xen0-ha           fence_legacy               ibmhmc
) ?+ L1 g# d0 Q) W) b6 N. n' hipmilan                    meatware                   nw_rpc100s
) q% g) B. Y; I, p$ P# U* l" @" Srcd_serial                 rps10                      suicide
% H% E& K8 O! }wti_mpc                    wti_nps
/ g* A( |4 s; r$ _1 UCOPY* D: L, O- h' C9 D. N/ e
Choose a STONITH type from the above list and view the list of possible options. Use the following command:
# `( `1 n" T  v% C- a& u
  B7 _- e, G; b6 ^$ k& gra info stonith:external/ipmi) b/ z$ K! r! {$ Z5 x+ g0 U7 U' n
IPMI STONITH external device (stonith:external/ipmi)
6 f, _8 b, P! H: }/ H3 S
+ m3 Z# M1 e+ s5 b3 s6 Cipmitool based power management. Apparently, the power off( |; D+ Q& }* m: l! h& j/ m
method of ipmitool is intercepted by ACPI which then makes
3 g3 w2 H2 H- Wa regular shutdown. If case of a split brain on a two-node6 B5 Y( o% I/ [1 A$ X. M8 j& E
it may happen that no node survives. For two-node clusters8 q. q- z# A# i
use only the reset method.9 [" m, i* k  Q7 X! n1 [, j1 @- w
' M( I# ]0 e6 v: ?/ y' ^
Parameters (* denotes required, [] the default):" Y" Y0 k% _  T! A0 P

. a9 ~- H4 c$ }hostname (string): Hostname4 Y; j, D, j2 p6 T! T+ e; u
    The name of the host to be managed by this STONITH device.
' h  s6 U8 u% n...; _5 F3 h4 ^, D0 K
COPY
( M4 U0 c$ ~2 g# U8 m- z1 QCreate the STONITH resource with the stonith class, the type you have chosen in Step 3, and the respective parameters if needed, for example:; j$ c* c7 M' n! D

) f  z0 }  g) |6 Hconfigure
9 S& ?5 {; G. U9 O: dprimitive my-stonith stonith:external/ipmi \
  K) q8 t$ H( N( o# C9 L6 I    params hostname="alice" \% X7 f8 I8 @: D7 K5 m
    ipaddr="192.168.1.221" \4 p: h& g5 p8 O- Q
    userid="admin" passwd="secret" \
. s# y. @! f: U- F    op monitor interval=60m timeout=120s
' x9 i3 S/ N* b% r! L' c4 mCOPY/ ?6 x+ r  J8 |
7.4.5 Configuring Resource Constraints: h# i$ [& v( @* r3 \

( C4 W/ q! ]1 i" t& P/ D8 Q" r9 WHaving 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.
9 D6 Y' P, M- T8 [3 u3 h& {" ~2 y8 \; A- Y
For more information about constraints, see Section 5.5, “Resource Constraints”.
* D+ E3 {& `' {) p' J' m+ w/ e' _9 ^/ ]
7.4.5.1 Locational Constraints
; I4 l* \* u9 X, S* ^) h6 w6 l" P- h# g
The location command defines on which nodes a resource may be run, may not be run or is preferred to be run.
1 c# t, v3 l0 j. L' _: O. P0 @  p! W+ R
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:  f, Q+ j6 x( a4 q# @8 D) e5 h" M
% e9 w# G! F; J% _& [
location loc-fs1 fs1 100: alice
3 ]. T! Q4 M& N- v/ N/ Z4 lCOPY1 e/ \  v6 S" ]7 i& r, Q& `
Another example is a location with ping:
) w/ x, _& O2 m2 o2 R1 }
7 X+ X7 k4 U+ `% Mprimitive ping ping \
3 [- Q" h( J: ]7 S) o6 m' i4 b    params name=ping dampen=5s multiplier=100 host_list="r1 r2"
2 D! O9 l8 b7 A, ]* H% B2 @4 N, m' Bclone cl-ping ping meta interleave=true
* h7 M/ M' j( L5 z6 \location loc-node_pref internal_www \$ o% s( N- x# K% k/ @
    rule 50: #uname eq alice \, H7 @2 S; i3 r4 S5 x
    rule ping: defined ping
4 B% Z, E4 U% t/ J3 nCOPY' j. H& c. U& f
The 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.
0 D1 {& x9 p' @- h$ G6 h" X' K* V: f7 b. B( [
The following example creates a resource set loc-alice, referencing the virtual IP addresses vip1 and vip2:- g& e  A4 a" M8 i+ M2 S

7 }% t$ i" e/ Tprimitive vip1 IPaddr2 params ip=192.168.1.5
* h) O; H, t/ Nprimitive vip2 IPaddr2 params ip=192.168.1.6
4 X1 d* b7 J+ u& F5 q) U  X& t' `location loc-alice { vip1 vip2 } inf: alice
& @( o  w5 b; \+ VCOPY
9 m' n+ \- G* b! {% F* Z+ `In 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:3 C$ S- P9 S  M) N, `5 F* }) V

' e6 ?1 T2 [# mlocation  loc-alice /vip.*/ inf: alice
0 [# _5 @. b0 f- H+ _* p( p; }( w! aCOPY
/ O  H% D4 G2 Z0 j7 X. g7.4.5.2 Colocational Constraints
& T, N3 @6 o2 {2 U3 X% ]9 d4 g! ]6 j8 t1 c% S
The colocation command is used to define what resources should run on the same or on different hosts.
, E$ n' d: x4 e. _. p9 k3 ^
3 k4 H% V7 j' [0 TIt 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.
! s2 A* B9 z, Z* D3 F" T" l9 X  B; N/ u  E  ^
For example, to run the resources with the IDs filesystem_resource and nfs_group always on the same host, use the following constraint:4 ]. t  f* d1 A" q4 }# L
4 z! v, W9 x/ P. `- C# C: b+ l
colocation nfs_on_filesystem inf: nfs_group filesystem_resource
4 L9 p. P% Y3 zCOPY
+ ~9 C0 q# |  {* p- ^1 a% YFor a master slave configuration, it is necessary to know if the current node is a master in addition to running the resource locally.
3 F: c1 x' @. x4 F+ X7 Z, A' ]
2 R6 d, |( r. G& S4 E: K7 K! |0 ?7.4.5.3 Collocating Sets for Resources Without Dependency
5 \0 |2 h9 m3 L) ?+ ^' [7 \" Z6 g+ ?/ C
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.8 g  V$ K8 j* c) c, y% p' B# F
; j5 F# N! ~* h6 {+ Y3 S/ L- {
Use the command weak-bond if you want to place resources on the same node, but without any action if one of them fails.* I% X; n. ]- ~$ _8 z+ H

5 C0 \9 P  |2 X3 g) g/ i  Zcrm configure assist weak-bond RES1 RES2. K8 k3 T2 @1 p9 ?1 A
COPY
  t9 i: {! M- |2 ~) \7 iThe implementation of weak-bond creates a dummy resource and a colocation constraint with the given resources automatically.
6 n6 }1 i9 }( k6 l$ {1 n; b0 v9 e
- E! o2 I" P! l/ o+ _3 L9 t. B7.4.5.4 Ordering Constraints4 E- i7 b& F5 U# ~. X: J% d  `
1 }% t: d3 Q2 l: N9 ^6 d- H
The order command defines a sequence of action.
+ m6 ?/ {" k: G9 g; U' c5 N9 Z8 q2 N7 r7 w
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./ w. Q! b2 d+ [6 b7 }0 J

& i$ c* q; r! \- s& W$ g. b' EUse the following command in the crm shell to configure an ordering constraint:9 q4 r- Z* a1 @8 y; S  d! M1 k

. g  N; C( Z( X  k' norder nfs_after_filesystem mandatory: filesystem_resource nfs_group' `' R! U2 P1 R/ }9 d
COPY& {3 T% i) {+ l) o( d1 ?4 ^
7.4.5.5 Constraints for the Example Configuration. Q0 ~1 M8 Q$ ?- M8 \) p7 ~
7 r6 Q8 b/ a1 ~7 m
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:$ G( J* y0 L* K# J/ j, m0 u

) E) D. e! v( n" [7 CThe file system must always be on the same node as the master of the DRBD resource.
8 E0 a# s0 Q& r# c) @9 D9 o) {; v0 E- _; a
colocation filesystem_on_master inf: \
( ^& C0 c% {- b8 L1 D0 [    filesystem_resource drbd_resource:Master
  B# J& t3 O+ O5 S1 A: K4 mCOPY
0 l1 |) e" Z; I+ R+ ?% ~The NFS server and the IP address must be on the same node as the file system.
, {6 ^  P' |$ B+ ^$ Z( p2 d) x' B
2 Z) B' n2 ~' G7 v+ `+ Y/ c: ~colocation nfs_with_fs inf: \
4 r( }1 t4 d) F+ B6 b  q: X   nfs_group filesystem_resource
, ~! k% V* z9 H5 Q" qCOPY. x( w; U) ]5 h' f2 a" w5 v
The NFS server and the IP address start after the file system is mounted:
2 k6 p9 b5 s, [& h; @8 [" E& C  B
6 d$ l, V1 T8 B' n- Gorder nfs_second mandatory: \
1 V' K6 }6 x9 z& y8 b  b0 }' Y5 c# u   filesystem_resource:start nfs_group
' P, Z! E8 j& f1 v) Q7 @COPY
. y! \2 k4 g- o4 m! {The file system must be mounted on a node after the DRBD resource is promoted to master on this node.& h5 o. l2 g/ D+ K) Q+ J
/ ^+ @3 |% S6 q8 S% F4 f: j: m
order drbd_first inf: \
9 l9 x( s* a1 w& w: Z; s    drbd_resource:promote filesystem_resource:start
* z. K6 C9 p- DCOPY8 w, Y2 Q7 l6 z( Y$ F8 g' B  p  Y
7.4.6 Specifying Resource Failover Nodes+ y5 ^9 Q. O* |! _+ J7 J

& X; y; v8 y/ ?& ]To 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:
/ j: ?+ ?) ^& u9 s9 {! S2 l7 l: \+ f, F, j1 o" ?) K
location rsc1-alice rsc1 100: alice2 H8 B8 |+ X* ?" r" l: J) S
COPY) ]6 c$ N- Z8 w; R7 J' b" M# 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.
5 ^$ A$ l# j! o/ j( a  H/ w# V: `# X7 q( N
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.2 i% T0 X0 J0 v$ ], C. _
5 j# ?# N) \9 z
For an overview, refer to Section 5.5.4, “Failover Nodes”.! n! U# z- a( h* g
. n, {3 S" e4 w$ z+ ]8 R) L  ]
7.4.7 Specifying Resource Failback Nodes (Resource Stickiness)
- L, \. ?( y9 C0 p. e
2 a# C! z  K  K6 _9 TA 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.
* V, }/ O9 F4 ^' l( [, B/ {) z. a/ l+ U- L0 t: k5 ?: X" B
For an overview, refer to Section 5.5.5, “Failback Nodes”.
2 G" \& p6 ^) f2 ^
7 i1 q- l/ ^* |0 N4 g% |: N7.4.8 Configuring Placement of Resources Based on Load Impact" F! Z7 Y! ?1 S

, I# N9 G- |+ P3 E2 z% E: vSome resources may have specific capacity requirements such as minimum amount of memory. Otherwise, they may fail to start completely or run with degraded performance.
. U' m* y* ]6 t: y* \+ R, E& w) x" l- R2 c
To take this into account, SUSE Linux Enterprise High Availability allows you to specify the following parameters:
3 e, J. [; k6 _- p. X! N3 H  l+ W( Z/ \$ ]- V* Q
The capacity a certain node provides., I3 I& A$ Z7 [: ]

/ O( {3 W  T+ J& [The capacity a certain resource requires.& _: W1 {( K' f, P7 X; ?

, V7 \! F2 l' i6 t7 E; _" hAn overall strategy for placement of resources.1 Z  _/ x8 g* W% o2 Q! H

0 O- U6 [4 p" fFor detailed background information about the parameters and a configuration example, refer to Section 5.5.6, “Placing Resources Based on Their Load Impact”.
5 V& e/ A3 I# @8 G! v: G, Z2 q( B8 h3 ~
To 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& B% x8 R+ H
7 T' Q, z* j  sIn 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.
. U. `1 l; o5 r/ W
& D' m0 k6 ~. p: D0 Z2 d) _( B0 CPROCEDURE 7.2: ADDING OR MODIFYING UTILIZATION ATTRIBUTES WITH crm( W/ q( |* ]# I
0 w1 ]* N% P- ^8 c" h% Z
Log in as root and start the crm interactive shell:
8 O5 |8 M8 J9 H! |$ q7 ^  |+ {# p) L! h) F1 n
crm configure9 J5 h% h7 |& \% U& \3 l) ^
COPY
$ K! x/ [6 B! A2 E3 RTo specify the capacity a node provides, use the following command and replace the placeholder NODE_1 with the name of your node:
+ {  R* n/ a4 a3 j" n+ X7 ~" N$ V
node NODE_1 utilization hv_memory=16384 cpu=8/ K4 o1 ?! ]7 C" t6 t6 F# w
COPY6 O' B8 I% G" @4 r0 {# {
With these values, NODE_1 would be assumed to provide 16GB of memory and 8 CPU cores to resources.
6 s0 h( @8 @3 @$ q$ R/ O: u/ J- o
To specify the capacity a resource requires, use:
& v2 g# Y8 n2 N# a5 \. W2 J  x, j# c8 v
. c4 H' r5 l, v# M- fprimitive xen1 Xen ... \
) \( F4 F- y  R, e# M7 `1 n     utilization hv_memory=4096 cpu=4" n$ I/ F! M2 ~
COPY
" t$ w3 w- _7 r, o. p- m- IThis would make the resource consume 4096 of those memory units from NODE_1, and 4 of the CPU units.
, @2 N4 t# z6 D" B2 o  L5 K3 m+ ~9 u6 H
Configure the placement strategy with the property command:
! o5 ]7 x! Q% ?! d6 b9 D. U2 R) U! m: x7 Z
property .../ ^0 T; D$ W" K7 f4 M" M4 r
COPY6 u$ o( m6 Q* {( h
The following values are available:
) t$ H% g2 ^2 k3 {; M2 R
8 ^3 R& P# X, K1 W6 H+ I9 Qdefault (default value)
2 a1 `, @/ G0 zUtilization values are not considered. Resources are allocated according to location scoring. If scores are equal, resources are evenly distributed across nodes.
6 Z+ w; l; z$ y+ r) L7 z( J0 h) A$ H1 H$ O3 P/ z' E1 }
utilization- u# v4 ~" X# i
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.
$ h: L- z7 l" \) E/ S8 O( V7 g: ~( N
minimal) z4 N4 ^- H' {) N
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).
0 H6 C8 M3 a& s' ?# b' u. x! v9 p! Z. Y9 v) q5 a
balanced
# u& Z: M4 P( d1 `Utilization 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.3 i, T( x  g0 L+ P5 `2 x
# l1 U7 n& x+ m( B
NoteNote: Configuring Resource Priorities
! n# H4 N" O6 m3 o7 {The 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.6 E8 ]  S: B# H

9 _$ u& A! C7 T  `2 hCommit your changes before leaving crmsh:
/ j. O! R! t- C# l, e
8 m( B- S% p% dcommit5 R6 ~; W" T; ~  c( `' ^
COPY; r5 v1 t- B* w" @% d
The following example demonstrates a three node cluster of equal nodes, with 4 virtual machines:; l0 ~9 `  ~% ~2 f8 R
) d  K9 P8 c; b& V0 {/ I" h1 Q
node alice utilization hv_memory="4000"
; G( s+ f8 g! @' j( S; i, }node bob utilization hv_memory="4000"" s8 O% [. q" l4 U8 ]' n
node charlie utilization hv_memory="4000"
. k4 B% E5 x6 A1 yprimitive xenA Xen \
# r! l& O* n% A& N    utilization hv_memory="3500" meta priority="10" \
) a9 k- w! f/ ]: [    params xmfile="/etc/xen/shared-vm/vm1"
( ~7 b; M" g, L) k- Q( eprimitive xenB Xen \& @4 O4 j' B7 ~
    utilization hv_memory="2000" meta priority="1" \
" Q9 V% u/ T' z" C4 ~    params xmfile="/etc/xen/shared-vm/vm2"6 T" l0 p4 r5 _+ U' l5 S
primitive xenC Xen \
- k$ P# `) q; g7 \    utilization hv_memory="2000" meta priority="1" \
6 r, \5 Q9 o- e& m; J    params xmfile="/etc/xen/shared-vm/vm3"
: [! _" o6 ]! E5 W- T' ~& |primitive xenD Xen \4 x  {" n  i7 V4 `
    utilization hv_memory="1000" meta priority="5" \" A* ~/ p) q" z% k7 E' j- g$ c1 n/ M
    params xmfile="/etc/xen/shared-vm/vm4"
" O' p2 c& m3 yproperty placement-strategy="minimal"
. C& V$ D! f+ H+ n; l% `, fCOPY
* Z1 x& P$ z( SWith 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.
6 l% V# e) ?, N+ _4 e% G8 O# |* A5 ~+ S5 b5 q% \7 c1 {. u
If 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.
, v! c2 Q. l& r5 A) l2 E( o
6 r( S9 d. |# v9 C9 W9 i7.4.9 Configuring Resource Monitoring
) T; P* x; A1 b4 s0 }, T
; b% a8 B, T( A; v- @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:" h# |0 O5 H) d: p2 Z5 J
# Y) M: w3 B4 j4 O- c
primitive apache apache \' ~% u% b& c3 J, e$ P
  params ... \+ J5 E! K. {3 f! S! A& W
  op monitor interval=60s timeout=30s
: P, F. ?% C6 T4 {) @) s4 aCOPY3 ~; [2 Q& E# J7 ~, J
The same can be done with:
6 Y0 E; x- X2 u" L! G7 b, V
+ Q$ T& p( O* s5 [primitive apache apache \2 T4 V  H) b0 ^( q# v
   params ...0 W; P) ~  g7 g
monitor apache 60s:30s
% k( `1 p0 O3 U9 e* k6 ~COPY
! e0 ~. ~0 T1 W' g% _For an overview, refer to Section 5.4, “Resource Monitoring”.) U5 Q% N0 \3 K6 t% x! J
7 A, l- {, q( H" q" ~; O
7.4.10 Configuring a Cluster Resource Group
+ d6 F& q% Z/ R* K  [) B- c0 G6 A! S6 W, T% b
One 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):
1 M; W  E8 p% q2 |# D0 ~7 w- G* Y
. P* v5 z& v3 y7 c% G+ R* ZRun the crm command as system administrator. The prompt changes to crm(live).
& P) ^2 y& t- W! d% W9 U4 ]
& M; y3 X" P1 {, ~/ u( ~Configure the primitives:
+ B  F! `* d! h; s8 |/ J
6 W1 x+ i& D2 K7 e1 ^configure
# i! o; h3 ~- ?( f; ]5 Qprimitive Public-IP ocf:heartbeat:IPaddr \
; ^! [" o+ H" `' N7 |   params ip=1.2.3.4 id= Public-IP6 `$ O& [7 E# o7 A! J( d
primitive Email systemd:postfix \
# Y9 P- h- j: y$ N) w0 f# H   params id=Email. X+ b8 ^% e( d8 `
COPY* z1 A. Q1 p: E9 ?# {% h! F
Group the primitives with their relevant identifiers in the correct order:9 }3 e5 ^6 v* B' j% Y# t; @

( S3 m6 V  K4 F" x2 L- lgroup g-mailsvc Public-IP Email
; n. H& o9 B( }8 fCOPY; k2 X* P6 u9 e
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):
* V& v) _3 T, E' U7 n2 U1 |, D, |! \7 l3 ?; W# X* j
modgroup g-mailsvc add Email before Public-IP
0 K- X; ^. m' y% t8 B9 }+ l+ dCOPY
( V" I  |2 h' W* }To remove a resource from a group (for example, Email), use this command:
, c  _% T4 K% K: Y0 X( L( H: n  m- Z2 l$ ^" n2 {% @
modgroup g-mailsvc remove Email. S4 H4 D) r$ T$ l' m! g3 m
COPY. i* z0 x$ Z$ O5 c. y/ F$ y! i
For an overview, refer to Section 5.3.5.1, “Groups”.6 L0 R$ d: ^2 m% J
7 O6 A' f( B1 _6 e
7.4.11 Configuring a Clone Resource; Y6 K8 z, O' n5 E  J. g
: }- ^" S" T6 `
Clones 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 `* w# I! ~$ t: b2 v% e; [, i4 k0 Z7 g5 _# m
Learn more about cloned resources in Section 5.3.5.2, “Clones”.
* w" L. \7 @: z& v
( A; ^  d% b" A( z, G0 [0 v3 `7.4.11.1 Creating Anonymous Clone Resources  J; B$ b  @$ Z. z' n, c

5 c9 P3 {2 ]& C0 Z% Q- W# _To create an anonymous clone resource, first create a primitive resource and then refer to it with the clone command. Do the following:+ e( P, x! Q2 n4 [
1 G% G' ^  R5 J6 U; N
Log in as root and start the crm interactive shell:! @& C( z4 J/ n4 g3 C. b: N3 W
& n; i) Q- `6 ^" t! u
crm configure
" J& y/ a8 }' l% f0 z. ?COPY$ g2 _5 S! X: O/ \& l9 c; |
Configure the primitive, for example:0 b5 b4 m6 I8 H$ N- a! M
4 a0 p1 F9 q, X+ R7 I8 O9 }
primitive Apache apache$ v. d9 O8 c: i+ B. V
COPY* M# m0 v4 e6 M. g- e! n
Clone the primitive:
" H9 K3 a6 V8 t* A( S' }! t; C" e- G+ W- I) E
clone cl-apache Apache  s" P7 f' S, K0 C! F$ C/ H
COPY
: Z; a! S; C; X/ g4 C. F0 R# n& |7.4.11.2 Creating Stateful/Multi-State Clone Resources: H; `+ \: y3 W- {

  E. e0 S- V- X) V2 C6 PMulti-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.9 i$ `8 c) `' j( l* p
0 n' i# h5 R6 u$ S
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., N; U% @8 g- A
5 I, X! q# R5 U4 h  w% m. j
Log in as root and start the crm interactive shell:+ U( {% h9 ^" j  \3 R
* b/ l; s3 c) Y* g: c- `
crm configure6 e( W' Z, X6 N9 m& }
COPY) {8 o  {. D  c( X& W+ _
Configure the primitive. Change the intervals if needed:
0 Y; k5 F8 p0 |. {" K9 ^: D8 z& N
4 x! R& q9 O" r8 Sprimitive my-rsc ocf:myCorp:myAppl \
# }( R5 ^7 R  K+ }, U    op monitor interval=60 \
% N- a' x0 Z  r5 U& d5 n    op monitor interval=61 role=Master) u' C. W. u! O* A, P
COPY
: I/ z8 Z/ @% ?7 uCreate the multi-state resource:# F5 h/ D3 R, ]. a
& d9 t; |4 h+ g& i9 v
ms ms-rsc my-rsc. l9 `$ F, l9 J, `% F
COPY
- {# q6 }8 n6 t3 p7 B8 X" [7.5 Managing Cluster Resources
2 R. ]1 d5 O! F% i8 f( T9 p+ _+ J; @$ \3 E) A
Apart 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.5 F; K4 ]* R- |  {0 j; W3 k
; L8 m2 a5 y- X% y5 t- W( a( f* h: t
7.5.1 Showing Cluster Resources
" |# `0 G0 R2 r0 _* H- T, I( D( Y) g' }# L# U* _+ }
When administering a cluster the command crm configure show lists the current CIB objects like cluster configuration, global options, primitives, and others:
) M/ a. a$ [: Z3 b( R* q
1 U. L6 s: v+ U2 j0 l9 J2 bcrm configure show8 \4 \3 Z, p. c7 s" `$ b: Z# s; |
node 178326192: alice
- W# B  Q7 j$ @$ q9 \# S3 Dnode 178326448: bob
2 N7 N7 I# a  J1 iprimitive admin_addr IPaddr2 \$ w5 [7 |7 x5 _. P& R
        params ip=192.168.2.1 \0 v2 y  `' c$ M( y& K
        op monitor interval=10 timeout=20. E3 Z7 M8 M6 N, P
primitive stonith-sbd stonith:external/sbd \
- A5 T+ J  Q/ u        params pcmk_delay_max=30
5 ]2 S" {  h% k+ Sproperty cib-bootstrap-options: \, ?& D9 ^0 ^! I, o
        have-watchdog=true \
: L3 ^, U1 T4 |% L" ^        dc-version=1.1.15-17.1-e174ec8 \
& X6 o! a2 S, d' {! i$ ^* |        cluster-infrastructure=corosync \( P5 B* o; _+ q% G
        cluster-name=hacluster \
1 t& D8 X8 L+ u3 x5 B" R6 a        stonith-enabled=true \3 L! j: x6 _1 H. b  g* Q; y
        placement-strategy=balanced \
2 ~. ~! q6 C' O0 A% j" X' g  c        standby-mode=true& Z% a! B* \0 F5 R
rsc_defaults rsc-options: \
, L- m# f2 C; ]7 R: c3 }        resource-stickiness=1 \
6 P) ^% g) f7 `2 o" e, Z3 U8 w. X        migration-threshold=3$ R/ J6 o7 e6 K% b4 ]( o( r
op_defaults op-options: \3 e6 ^5 c. m& p1 V" u0 N
        timeout=600 \
7 b$ f$ M" K. n1 z" E        record-pending=true
- \; o# d0 o& Z4 B$ ECOPY
# m1 v3 I7 m2 i7 P; i$ oIn 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:
# ~+ \3 g3 P* J8 M
8 w6 b2 k! q0 [5 k1 _* vcrm configure show admin_addr
0 W, G! W- r& [3 b' s4 ?# O6 dprimitive admin_addr IPaddr2 \+ Y2 K; q# `0 L, a& F
        params ip=192.168.2.1 \- `6 n- h  G) {8 b  }
        op monitor interval=10 timeout=20
' E' ]% H4 O$ M6 QCOPY- s7 V8 f/ A3 k) w
However, 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:$ a. ]! }  \6 {
" z' o+ ~% z+ \2 M4 g3 H! j) q- K
crm configure show type:node
" ^+ o# Y& v; y5 Pnode 178326192: alice6 `) a) Q1 j5 C1 b
node 178326448: bob
7 d5 G# R9 U5 U1 Q  v9 ]COPY5 K3 ?& v# m8 K
In case you are also interested in primitives, use the or operator:; j+ {5 F* \& y" Q% E
) w; z% m. C# b7 V3 g
crm configure show type:node or type:primitive
8 k5 _9 o- {% w: q$ Ynode 178326192: alice7 w% S8 Z4 Z2 {( H- `' k
node 178326448: bob
6 A: s# |0 l, eprimitive admin_addr IPaddr2 \
  ?( e( H7 |: l  i1 Y+ C  U1 w        params ip=192.168.2.1 \
# b, r+ a5 o. P' o& E        op monitor interval=10 timeout=20  o4 A1 q/ P+ R0 C. k  ~& \0 W2 N
primitive stonith-sbd stonith:external/sbd \
3 R3 l. d, @) b4 V        params pcmk_delay_max=30* Y. U: G, U# W* y6 f+ m* y
COPY
' Z0 ^$ j! e3 r0 K$ rFurthermore, to search for an object that starts with a certain string, use this notation:. s. n/ @9 |  A, U$ T7 f
( S$ m% `' O  c: y/ j4 P5 ~8 U& m
crm configure show type:primitive and and 'admin*'4 S; K0 x, H4 ^- y; N4 p* R
primitive admin_addr IPaddr2 \% W* a$ P' n4 x
        params ip=192.168.2.1 \% S' r7 D/ \3 q& |1 I/ D5 m
        op monitor interval=10 timeout=20
: W1 f0 }- r' m# V% kCOPY
' n1 D; ~( H' 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.
1 L! p3 b# I/ U4 I
+ N# f5 x: l% Q9 n. X% P7.5.2 Starting a New Cluster Resource
( Y$ P7 @# C# a& L/ g* @' w; \$ [
To start a new cluster resource you need the respective identifier. Proceed as follows:) d; r3 A$ {9 h2 y0 C; [( u6 ^9 J' N

/ ~) |6 j! O* V/ O+ ?0 X* \6 b4 {Log in as root and start the crm interactive shell:6 |" i# ~. t& h
3 I3 e- @0 |, Q4 S- C6 a
crm
- `7 Q5 C8 P) \! eCOPY; K6 ~2 l$ ~3 u2 t. K) f( \* e/ w+ r
Switch to the resource level:& ~$ }/ a) C0 Q* e& c, z. U* c
, A: p) D/ z& i2 m1 R3 z
resource
! q# \" M- ?( t+ Z+ I: FCOPY9 V1 w3 {/ C4 Y6 D
Start the resource with start and press the →| key to show all known resources:6 F$ z6 j7 J$ g# ?" H

' _( h- @& R; R3 a8 e' p$ Kstart ID7 m" I) z# I) e# d. f( I% ?" N
COPY
4 }9 N& H: w# R; ~1 L; M9 g7.5.3 Stopping a Cluster Resource
4 I. P9 ~  \- d) S; S) c' V3 i, h* C2 e5 R' `+ v
To stop one or more existing cluster resources you need the respective identifier(s). Proceed as follows:% \6 \. f3 Z) b3 g$ _5 U8 q! i

; W9 U" d9 y' o/ `Log in as root and start the crm interactive shell:
& o9 W# H9 X3 k: L: J4 n" ?) q$ G5 s+ h; Q! Y  m" n6 `
crm8 n. |$ _6 C4 k4 ~+ Q' D
COPY& Z, u$ a9 \4 N
Switch to the resource level:
2 n# ^1 r1 s9 a9 o% D8 L5 [9 i" P3 u. Y
resource! [, a9 v" M% X" d$ X( ~
COPY
( N5 f9 t! ]6 |' |. lStop the resource with stop and press the →| key to show all known resources:: a$ F+ ~3 l4 Q/ [+ O: E

4 N* y6 ^3 r( g3 |$ rstop ID
3 _: @& ~6 w# i! Q  g! h" S+ b+ {0 UCOPY
4 L9 Z* `, f0 l; S2 i% k  Z8 SIt's possible to stop multiple resources at once:
% c, O# h* f+ z2 A5 R$ {$ A
& S" _0 I  X& E3 [; i9 L% nstop ID1 ID2 ...
9 g% y2 G# L" `COPY, R/ Q1 b2 S) H
7.5.4 Cleaning Up Resources% {* X2 z7 W6 m9 \" i! U% r

( g3 i) C! O4 W! j9 S" C9 F8 UA 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.
3 X$ ^' w1 G; g* c' U3 T  d7 `7 ~7 S# R) ^3 a- f. E: Y/ Z
Open a shell and log in as user root.1 V2 ~5 D4 H  ~' `& v/ k2 H
7 u; J  Z$ ]6 y6 t- g( h- C
Get a list of all your resources:
0 t; d) @) P4 k+ r1 w' q& n" s
! y1 k! o9 [9 ]" g" Vcrm resource list
+ p5 E! ?% w$ [3 s3 g* U0 _/ ]  ...
7 a) a, x# z) {$ bResource Group: dlm-clvm:1
) i$ l# {: A5 D! c         dlm:1  (ocf:pacemaker:controld) Started' o. f7 l! J% }8 J! ~, ^! i2 }
         clvm:1 (ocf:heartbeat:clvm) Started+ R: a& @5 v$ W* S" A* S9 @9 o
COPY+ b  E0 W. e; p- U8 U
To clean up the resource dlm, for example:
; f: M1 r7 O5 ~- ]) D( \& j, p( }, b" V% n
crm resource cleanup dlm
+ |6 o, w" d9 |, Y8 q, YCOPY
3 F! t7 v4 m" w3 O9 M' N7.5.5 Removing a Cluster Resource
/ T( T* f* w3 x: U) [
6 B1 L& l! f. }+ |. F! }$ DProceed as follows to remove a cluster resource:
' t! d) Y, U7 h$ H2 {; U
) P6 f$ t! w* u! ELog in as root and start the crm interactive shell:
2 i: Y& A0 c) s/ N- j/ w( m& _
" X  n" u) F8 |1 m  dcrm configure8 J& \$ _7 J) k; E
COPY
2 @: T0 W7 V: i* T* _. a+ DRun the following command to get a list of your resources:; `. c" ]# m3 {

; d9 u7 R5 o# F& B  Rresource status
# E( W2 F$ R# ^8 [7 D: rCOPY( n1 B0 E$ r+ S! S0 ?4 ]2 c) C
For example, the output can look like this (whereas myIP is the relevant identifier of your resource):) J, M0 t) P  J; V3 J6 d( a

: v3 u4 C: L7 X! O+ k& TmyIP    (ocf:IPaddr:heartbeat) ...
: w5 q$ H1 R2 r, N0 QCOPY
" j+ D4 a0 ], h7 [7 _! D& tDelete the resource with the relevant identifier (which implies a commit too):( d( s0 c" {3 N5 y  Y

5 m# d; G$ B, B* @& o$ o9 }configure delete YOUR_ID
" I+ K3 f& o8 k' V/ u' {" ?COPY
4 R+ d: J2 ]6 [' M# T* ]* ]& [Commit the changes:
9 p8 ~. }6 T5 y& n4 Z6 e$ @6 S2 m0 p# S6 Y9 [% ]
configure commit  ~' I2 W, F( S
COPY
( X3 h6 j: y, q/ Y* x4 S7.5.6 Migrating a Cluster Resource9 z$ E; s4 F. g( [

+ C/ j" F7 o5 O6 B0 I+ U) f/ O' Y5 ?Although 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." K( S; [$ j5 i, n: O* x

! H5 y- d/ ^9 G* S- |Use the migrate command for this task. For example, to migrate the resource ipaddress1 to a cluster node named bob, use these commands:
3 e5 z% P; t9 }, j
6 Y5 y- t, k" l" t, p3 Ocrm resource
2 L1 G& t9 ]! b4 gmigrate ipaddress1 bob
3 M" s0 ^! I, t, Q2 p0 HCOPY
8 E, |1 |6 \  q) x3 z7.5.7 Grouping/Tagging Resources
, Z! Q# J4 x/ _5 z' r8 ^
1 d" x/ a' Q! F- y$ VTags 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:0 m! O& K# V/ c! g& c7 F% }( E

( h+ [( g- g$ V) ^' g' Dcrm configure tag databases: db1 db2 db3% Q$ y) @' d: N, S0 _
COPY
8 @4 L: H& `+ `This allows you to start them all with a single command:
9 b5 P3 O9 ^" }! R) R; [; j" D) q' I
8 m* m" X! p$ u# `. rcrm resource start databases; }+ P) u% L# ^; B
COPY
- q. ~. A, W# Q, p' OSimilarly, you can stop them all too:3 G  U' z/ Q% ^7 L- w( a/ w4 O

4 N# k6 Q; [  k' ?6 qcrm resource stop databases
6 ?3 h! X* c3 v- ?COPY. T* Q7 ]" h" o- c" ~. \
7.5.8 Getting Health Status  P1 t4 L; j8 x4 R! H; [

" W3 I/ L6 {" i+ w) IThe “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.# W4 [% r: X1 m6 u6 c+ U

3 x/ W( @0 V" K. R/ _To get all the details about the health command, use describe:
. {( k+ v, @, T- e2 X7 T0 V
* ~4 s% |3 Y# a  H/ ?9 ?! ycrm script describe health
4 F0 J! u" h" Z; X* Y! ]COPY0 r1 D) d, A7 N" C8 P" H0 {
It shows a description and a list of all parameters and their default values. To execute a script, use run:& O$ C" L: K5 O1 s' c
: r* U' P7 s! @1 z
crm script run health6 @( V5 R6 B& O% e5 m; L9 Z
COPY
  R* Z- ~/ n% a1 h9 B" qIf you prefer to run only one step from the suite, the describe command lists all available steps in the Steps category.
% s3 t& Q7 I1 J# Y, n! N/ H1 x( `0 a: o* H4 n% S& H
For example, the following command executes the first step of the health command. The output is stored in the health.json file for further investigation:
3 q' N8 l+ M& ^6 X% Y- R. D% y' D- c2 S* J2 v$ H) e# X# U
crm script run health
. D5 \5 Y) Y4 W! W) l- z" [    statefile='health.json'
7 Z& r& [! u; W# aCOPY( e0 ?$ S6 d3 q/ ~9 l
It is also possible to run the above commands with crm cluster health.2 ^# @+ c5 x0 Z& L2 b$ h7 U2 M
* y- J0 V" i) \; F. x
For additional information regarding scripts, see http://crmsh.github.io/scripts/.
& P4 b2 }# r" k6 C* l0 _& W, z
9 l8 u8 T9 w3 }2 h5 l( X% l7.6 Setting Passwords Independent of cib.xml) c- Z) b9 W4 p
4 b/ v4 @1 L; h$ b" t
In 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.3 p  k& m9 O- f% t) x

' B) W, C6 D4 U' D! n, e/ q  oBefore using secret, better run the show command first to get an overview of all your resources:7 [4 d; X7 C0 t6 g9 s. y. ~
1 x  j8 h& ^3 p- ]! t8 G
crm configure show2 E" \7 }  q0 V4 X# v9 V' z, M7 {
primitive mydb mysql \
9 k6 q( C$ f5 `- h! c- @! O$ B   params replication_user=admin ...
7 k# G( u+ u7 A" N0 QCOPY
1 X+ y/ ^2 T# A0 B( kIf you want to set a password for the above mydb resource, use the following commands:
7 H7 X. z7 |- \. _$ r" a3 w5 ]- ^6 _* d
crm resource secret mydb set passwd linux/ `+ n& n1 l6 ~2 G" R+ x
INFO: syncing /var/lib/heartbeat/lrm/secrets/mydb/passwd to [your node list]
* x7 ], I  t- ACOPY7 z$ h$ u% R& Y+ _8 `: u6 a
You can get the saved password back with:4 Z" H# ^: ^! x, [" z& k
* L  g' p2 S6 c0 J% {
crm resource secret mydb show passwd
* H6 F9 `7 {# U3 u; n- H' a% m2 Ilinux5 H5 @( x$ l, ~8 R# Q/ O7 P0 _0 U9 R
COPY
5 |6 v/ t  G: MNote 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.; N& S, }9 _8 S1 A
3 _& }7 D/ l7 I" P  j3 E, T! p; k
7.7 Retrieving History Information
' e& V; ^  k9 B5 N8 W9 y) ~) C* @/ A* d. N' V! I+ c
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.0 f. N! U6 d( A. _: o+ c

8 e4 a: t8 l) ~Each cluster moves states, migrates resources, or starts important processes. All these actions can be retrieved by subcommands of history.  }. A$ D: F' m5 G) o" X1 t

% x7 J3 {0 v7 l8 X, ?; fBy default, all history commands look at the events of the last hour. To change this time frame, use the limit subcommand. The syntax is:
; ]9 b2 Q6 ~% S1 p2 @0 G
' X9 n! D5 W5 |% l' jcrm history; ?7 f  \6 V# u& y! Z# R# k
limit FROM_TIME [TO_TIME]
* p1 ^7 K/ q7 }  s5 t" CCOPY: w# g7 m! Y  K+ g+ C
Some valid examples include:
+ N, }% d- P; x8 t7 y8 y/ t7 x- y2 x  P2 B: k3 ^7 e; O0 Q: n3 F
limit4:00pm , limit16:00
2 r' f3 E2 R& D; D7 m! F( BBoth commands mean the same, today at 4pm.
% K& p( m: ~4 }" d+ q- Z3 m' J
1 Z* F/ d1 B! R9 G& Elimit2012/01/12 6pm
- `/ ^  d4 d/ W% Z3 t  z8 R+ dJanuary 12th 2012 at 6pm
4 O# d0 p  c' d9 E- b* |( t- u" y; j2 ]
limit"Sun 5 20:46"
' H1 C( c5 \3 T* s7 AIn the current year of the current month at Sunday the 5th at 8:46pm! n# h9 z2 o& F  j
0 N( N! K9 j4 k) f
Find more examples and how to create time frames at http://labix.org/python-dateutil.9 d! I$ l) ^+ g. a5 H
$ a7 f- t: n; `- j" }) z' y
The info subcommand shows all the parameters which are covered by the crm report:) S# O! d9 j$ W

% g; _1 o+ {' S( U. ninfo
+ Q& e7 n1 r2 A, L* n5 K) ?2 hSource: live
+ c$ E- `$ o: |1 w2 `Period: 2012-01-12 14:10:56 - end
% d! S$ R) h$ B( w# t- o% g* iNodes: alice
' t# o( W! d1 j3 E+ xGroups:' D3 l+ ?0 s8 Z4 X
Resources:
0 d$ [, O( `8 E: Y3 aCOPY
' _  K- x7 s( v# z" GTo limit crm report to certain parameters view the available options with the subcommand help.& N- I# w/ R0 T  O# K

. v2 r: ^- h' l2 X$ @  V. NTo narrow down the level of detail, use the subcommand detail with a level:
0 p. D" ^3 Z5 u$ i. [4 w
' ^) @, G# S6 }- S" l. Jdetail 1
3 i, I# R0 T2 I8 n- A# E; c, k1 dCOPY
7 `& _, p% Q3 b9 YThe higher the number, the more detailed your report will be. Default is 0 (zero).7 e7 F1 E: v% _1 W% j/ V

$ [: ]% ^# N) x3 b2 }2 [2 nAfter you have set above parameters, use log to show the log messages.
% P1 N5 x4 q. S) w+ X! T1 P3 R6 e( K; g; l9 l9 d4 t+ ^- T
To display the last transition, use the following command:8 i( P; s' R! F. S

; n  G9 p, R  E2 Ytransition -10 L: F4 w: W* E! X* L( u
INFO: fetching new logs, please wait ..., s4 i# A/ F) @  l  v. J  T
COPY
) d, W7 N& G( `6 `$ mThis 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.% d1 _' \0 d) t
! F0 _8 D# r  N
If you do not want to open the transition graph, use the nograph option:
! A7 j9 e. e9 G  v! ]+ [0 C* L$ H+ b3 H0 z7 K( C! v
transition -1 nograph
0 n- _% y( B6 j& c' G
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-6-12 00:41 , Processed in 0.030252 second(s), 23 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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