易陆发现互联网技术论坛

 找回密码
 开始注册
查看: 2|回复: 2
收起左侧

crm command 编辑文件 shell

[复制链接]
发表于 2023-12-22 11:39:28 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?开始注册

x
CRM shell / text based; b2 R+ O$ Z/ m
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.! }6 j  I. T4 E9 l. A
# crm configure edit( n' ]6 d# Z% J% k  h$ V. w
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.  
; e+ j/ X; n  Q3 s$ Z4 o+ A# crm configure edit <primitive name>
1 o% J! n' k- @% p  HYou may also choose to edit the xml version of the cib.
" K$ j# z( |1 [+ B" l# crm configure edit xml3 Q7 T" v- @' J; J
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.  
! Z; g6 W, L1 I  M5 P8 E  _7 [2 cAdditional Information
. l, N( [  w* I. B. A. x% FA quick text backup can be taken of your cluster configuration using the following command.( X5 P  h0 b1 F! \
# crm configure show > /root/cib_backup.txt
' ~3 \& e7 e! r! CTo restore a cib from a backup file previously created.
8 \& [+ d& O0 }/ b9 d3 o( H5 s, Q# crm configure load replace /root/cib_backup.txt
) I4 e. \' D  d7 G! v
 楼主| 发表于 2023-12-22 11:40:10 | 显示全部楼层
To output the usage of crm and its command line options:
3 `. r" H  j* C" V3 y
' B9 Y$ y6 ~* M) U* Ccrm --help, U9 X0 n. R) C+ c
COPY4 t  s* n- `- m7 c  {
To give a list of all available commands:
5 s2 N: W: n" R8 }9 t* [
! r& b9 a8 f9 A: I7 ^. Ccrm help
  s- O/ ]5 P, N/ Q* E- R+ M, iCOPY2 g) j5 O& G- A2 p; T! l
To access other help sections, not just the command reference:, b6 H7 s- Q  K7 x, z: @, ]
- y2 e# m1 E; Z- c- K
crm help topics
* o( }$ E% Q; y$ u  LCOPY
. R2 }% M: V( R& p( b/ hTo view the extensive help text of the configure subcommand:$ ~& _. S' _( W+ ]6 f, m+ D9 P- h
  X" T# f) `, ^* `- z% F& [# t
crm configure help
# M, u8 G8 l6 SCOPY
$ U" e1 l& \( P5 t+ i5 \% j+ k& jTo print the syntax, its usage, and examples of the group subcommand of configure:
' `& m: l; y, m' c9 @, _. ~# r! X( ]" Y
crm configure help group- a2 R  A- m% H. ~; g* Q
COPY  f) t3 H; s& m" n, ]
This is the same:7 C7 b' k: a: j/ T. ~- ~

2 v/ \) B2 j* @5 `; l- ~crm help configure group
8 N! q8 S# H" A- u: M& o+ h. _  hCOPY
 楼主| 发表于 2023-12-22 11:54:34 | 显示全部楼层
crm options user hacluster
. S6 O9 ?9 u9 Z- \& W" {COPY- h9 k, p5 T! l9 C8 E9 J; o+ H
Note that you need to set up /etc/sudoers so that sudo does not ask for a password.+ y) a/ I2 e5 K% `. v
' J! ~% T9 F: D0 H" ^- I9 b! a
7.1 crmsh—Overview
- C+ T% G" I  D, l: v& U8 N8 {9 {) L( l0 ~7 m! J( ^1 x9 \
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.
/ {& T9 L$ S2 C- f! n" ]; ]% @* A7 \0 J8 E
TipTip: Interactive crm Prompt9 u' q  B6 F2 g1 @6 d  `
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:9 o. |% N5 O& C9 c: S% i$ ~) E
8 c" L! j9 A- A% S6 M1 }. d  h& l
COPY
" b5 @- i1 M, |% ?" {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:, Q6 Q. [' ]* Y, e. z5 ^; ]% K
  c$ R! W, e, [3 e
COPY
% q/ m" ?+ S6 o7.1.1 Getting Help
5 _; O8 `' g/ T6 m
' S4 t. E$ K0 [+ z$ E$ r. O5 r6 yHelp can be accessed in several ways:/ S& w9 t9 u4 q* Y' l' U
- Z' A5 e  o$ J% `. x- h8 ~. ~
To output the usage of crm and its command line options:' O* Z2 |  Y8 w; W

; p/ l" a0 P. U2 h/ ]crm --help& d: c; s8 h/ f) A& m6 T
COPY
, k; Q* A  E! c0 ?; ]2 J9 uTo give a list of all available commands:( c6 V# D0 L; u/ f: y4 W
8 H  j4 u; ], I0 A6 y8 v: g: N
crm help0 m& x3 [' M6 x+ b6 `
COPY
; e+ b$ G( F8 g6 W3 d) D9 h! WTo access other help sections, not just the command reference:
  E: k# ^3 f# J9 R+ I
1 u6 z- ?( z5 Q! `9 [; bcrm help topics+ K, `8 C& }8 O1 Y
COPY
1 r" S+ {6 x% q& d! c& G1 h7 vTo view the extensive help text of the configure subcommand:
0 L* o& A% X4 i; A( m" K# t
# x1 }- \6 G" _$ h( Y8 Vcrm configure help
9 c4 P9 m4 K, S/ y4 {COPY1 F5 p9 ?( V) G4 M9 G6 V7 I
To print the syntax, its usage, and examples of the group subcommand of configure:+ H5 h* \# _+ W, j

0 P+ {- R0 d$ j5 ~7 bcrm configure help group8 z, R% ~$ S* x) N* |4 B0 u2 b; h
COPY) a" S4 y; P( ?6 q6 R  F* X
This is the same:& o+ G/ N$ ^/ x  y$ Y

% F& W+ [" t4 x3 G6 jcrm help configure group7 A2 y( G/ S2 h" i9 d
COPY6 w! Y- q. [4 ~" G( b
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.$ x4 u0 ]" R! c2 S6 U! y3 y) x

/ k: n4 e! u( e5 XTipTip: Use Tab Completion in Bash and Interactive Shell
3 i. e1 ?& t- Y; V! w4 Q. K8 gThe 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.
" x/ C$ r' ]% c" [; n
. D6 v. G8 [# G7 v& O1 O7.1.2 Executing crmsh's Subcommands8 S% ?1 f- |, s. J: X2 J# ]

; A3 v( ~; \: `4 Y% X- ^The crm command itself can be used in the following ways:
& j' K+ `( h2 n2 z- W
  p' w/ H7 M8 O% S  k2 ]Directly: 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).
" }# }% y3 m7 _; `  K
5 J3 o9 H5 c7 m9 O) j! TIt 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.
1 q8 b( F) R0 u% Q, m# s* h& r) `1 a( D, S6 U+ b
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:
1 m+ f- U, z7 T
/ o* @, J! w- Z+ p& F/ Ycrm primitive ipaddr IPaddr2 params ip=192.168.0.556 ~( z; h! s% @7 `8 g+ Z; Y
COPY
- g+ p: @/ O# Qis equivalent to this line:
/ A$ D" V& M* x6 y/ P# A& p$ u* \. ?/ [7 B6 i
crm primitive ipaddr IPaddr2 ip=192.168.0.55
, |& |! I6 i- i/ \4 G% w* hCOPY8 l  h2 {/ p7 o. F, Y
As crm Shell Script: Crm shell scripts contain subcommands of crm. For more information, see Section 7.1.4, “Using crmsh's Shell Scripts”.: @% V! T9 i/ t' ^: F
  u! e" |5 A, V, j( A2 s
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.9 N2 m% h# ]/ |2 J3 U3 Z" c

9 d* g+ s" U# ^& H: m1 @  HDo 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”.
. n' L) v% q  a! M2 \7 @, h" m. D/ j: f# m# x- K& i1 ?$ u
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.6 t1 ?- B: P/ r0 l7 K4 E8 X

9 i+ B9 A  b' V0 }) a- D' U  }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.; Y; }+ O& O& j; }! L
: L( C( L3 F& X, c: F; m
You can enter the level directly by typing crm and the respective subcommand(s) without any options and press Enter.
- _: K* `3 q' _5 O! e8 D2 }  n/ C+ @5 t6 t- Q
The internal shell supports also tab completion for subcommands and resources. Type the beginning of a command, press →| and crm completes the respective object.7 o, r% ?8 F: c  l
4 T3 z5 t0 H  L+ n; q
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.
$ T, Y/ O3 l# F- i* ]# o2 J$ d7 ?4 N$ T" [& a' e: m" Y
NoteNote: Differentiate Between Management and Configuration Subcommands" n& c, f" ~4 T0 N# @+ X
The crm tool has management capability (the subcommands resource and node) and can be used for configuration (cib, configure).
% V- h  E+ E- ?! b2 m; [
: P& A- L# Z7 Z5 d/ A* TThe following subsections give you an overview of some important aspects of the crm tool.
' |! X" r- |4 {- F0 [7 L' X+ M/ l6 g! T3 H& y
7.1.3 Displaying Information about OCF Resource Agents
  m6 C5 b% `7 V% b+ W2 s. r8 e7 B4 |9 g; z
As 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”):
0 s$ J+ D! F: [
  N/ V% |. q' n* [crm ra3 C7 I: g' |% W8 e2 b8 [! {  u
COPY
( j7 k9 K* F: RThe command classes lists all classes and providers:# H5 q1 \. ^: a* n+ T) A
% M1 E4 X7 M0 ~% d5 Y' _  s
classes( I) i  N% h! |+ _
lsb
0 D8 I, s* L' J0 \ ocf / heartbeat linbit lvm2 ocfs2 pacemaker
+ H* |8 o: ]8 j' W$ k. E1 u% J service
& B+ Z! Y4 v$ i! ^& z stonith
) ~9 m3 m3 [( ~3 g! v! c$ [! i systemd6 \5 s1 C$ X9 P: V0 l" K- u4 v
COPY
7 K  c. ^4 Z+ V/ Q) NTo get an overview of all available resource agents for a class (and provider) use the list command:
3 V, L0 h0 y" R) Q( w/ G& ~' [# m* C% m0 G, f
list ocf0 q, i/ X) }/ z  e7 G
AoEtarget           AudibleAlarm        CTDB                ClusterMon
, ^# Y+ k% t3 D9 n" @Delay               Dummy               EvmsSCC             Evmsd) a0 \5 Q6 W$ p: o. W: e
Filesystem          HealthCPU           HealthSMART         ICP
8 |/ Q5 a* a' r# i8 tIPaddr              IPaddr2             IPsrcaddr           IPv6addr
) p9 I% e. {8 \4 Y' d, s) M$ Y# d' B2 ILVM                 LinuxSCSI           MailTo              ManageRAID6 ^% d( W6 c& B' Y0 U! M' k, x
ManageVE            Pure-FTPd           Raid1               Route
$ ~  a* n3 v) Z, `( o; ESAPDatabase         SAPInstance         SendArp             ServeRAID& L; l4 j" n* L4 g
...
/ ^* d. S7 Z/ f  OCOPY
9 c4 ^1 I4 n; h* P! N1 OAn overview of a resource agent can be viewed with info:
' k. C8 _: {9 L. C# T5 Z9 ^6 Z6 t# B6 M
* i0 [9 ~( x9 `! C5 ~) linfo ocf:linbit:drbd4 C+ k. J$ S. o& l/ s, a# B9 f! ?
This resource agent manages a DRBD* resource+ ?- v3 r5 ?  x
as a master/slave resource. DRBD is a shared-nothing replicated storage) _" a/ J$ _9 z  b/ B/ }- }! P
device. (ocf:linbit:drbd)) e, E1 S& a+ t. P
. z! D/ M& o/ t9 |6 G) m: x
Master/Slave OCF Resource Agent for DRBD' S. I4 K2 L: T7 m) F

% @; }1 z1 S' _' ^- @4 U9 c' S6 GParameters (* denotes required, [] the default):
1 H  `# l! e* V# s
+ T$ n8 |) ~( B5 A5 Y) udrbd_resource* (string): drbd resource name
/ \. N$ l' m0 n$ j) }    The name of the drbd resource from the drbd.conf file.- e. C$ ~' l) _, z, G
2 m. P$ O- x1 P! l6 H, ?4 N
drbdconf (string, [/etc/drbd.conf]): Path to drbd.conf
' S8 W! J7 Y; O9 S% E! T4 }, o- Z    Full path to the drbd.conf file.
  I- l. G" k. ?/ o1 q( [
% N; s& q% ]6 J2 YOperations' defaults (advisory minimum):" R. W* T* x& c4 c/ g

( d# ~: b! o5 b/ S- a# M  f    start         timeout=240
7 y& F5 A6 T7 d; v    promote       timeout=90
, z9 |! k% F# g' H. U* O  H5 h: }    demote        timeout=90
& t: p/ M% O: W, t8 T    notify        timeout=90
% C6 p7 C" v1 G9 {4 H/ S    stop          timeout=100
* N8 P4 I' \- D    monitor_Slave_0 interval=20 timeout=20 start-delay=1m
$ @- q  G: d) O' a% J2 }    monitor_Master_0 interval=10 timeout=20 start-delay=1m
8 _3 b. B/ E* X% b& L' [& cCOPY1 r4 L% P! r8 w/ E$ f
Leave the viewer by pressing Q.
9 t/ Z* A6 @0 }  e$ p* P- H+ B* n& ]% q9 Z
TipTip: Use crm Directly  S- x7 h0 O/ j+ F* H
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.- r! j8 x6 ~5 V& K# }) K
& M$ x, E& I: Z$ D$ S
7.1.4 Using crmsh's Shell Scripts
3 n& b' _; V1 S& c+ g; _  {$ ~& i9 u) b3 ^+ |/ S' I
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.; ]6 l0 A/ s: s  N6 T0 ^' z

4 j; R4 Z0 s2 U4 ^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:+ G; P( K$ }! S9 [+ X% v; s

$ Q6 G: T$ O& s/ e* I1 PEXAMPLE 7.1: A SIMPLE CRMSH SHELL SCRIPT
: p$ z3 J" B* r: g, r
: E2 M8 ]% k( Z- p' K% }" C5 w6 O# A small example file with some crm subcommands
! y7 {$ j! L" \; L& sstatus
$ A7 ^; A9 k& e5 i+ ]& Pnode list
& m1 k+ y7 ^* u, H3 cCOPY4 W- j/ x4 x8 O
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.( [  Q# `2 ^/ J8 i6 d0 [% l# `" Y
: w) f8 o: h( l( u3 {
To use this script, use one of the following methods:
( F% `( @- C3 e, \; z0 u
1 f; m8 j1 C" c1 z7 ~0 s/ Rcrm -f example.cli* t1 o7 B& `3 ~
crm < example.cli
# j+ E1 R( Q* E* Q- nCOPY& g8 f/ i2 _; \. {1 N' M" g. s) c' P0 V7 b1 O
7.1.5 Using crmsh's Cluster Scripts
# W7 o! Z7 }" B( g5 d
7 }0 f- K4 H+ f; V: \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.
7 v. u" r2 E2 Z: {, S0 i# N. `/ a  f1 l- f
Do not confuse them with the crmsh shell scripts, which are explained in Section 7.1.4, “Using crmsh's Shell Scripts”.
! J, J8 W6 W% }; |- B! U# C
1 r) [3 ~( G* w0 P, G( g. K* hIn contrast to crmsh shell scripts, cluster scripts performs additional tasks like:! s; @; v/ a! k% o
' \7 {, e$ E+ \! n9 N
Installing software that is required for a specific task.
/ T) Q, b; s+ {4 v& {& f3 _) S: A+ n, i- d
Creating or modifying any configuration files.6 ~7 b5 [( P3 _, Y7 d
' G6 Z% b) ~+ o' D" [% T
Collecting information and reporting potential problems with the cluster.
. u  B, T, N: ?3 d
& {) Q& p$ A) t7 }* X/ X3 w; aDeploying the changes to all nodes.) o1 m# y2 l  p# n: l7 @7 C* o! r
8 r$ O. x) d8 @: [9 x5 @
crmsh 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 y* n. l% W; ?5 u

+ D$ w9 @! R  p% v9 N7.1.5.1 Usage* d% u5 W* d; f8 @* s+ F
) s3 g: m1 w) a' T! s( F
To get a list of all available cluster scripts, run:9 l/ k1 Z3 T. X. f; F* L2 V& q* n, x7 Z
' ^# e/ G. m. Q6 k$ e; g0 w; s
crm script list
7 O$ ], O1 K. i/ e2 P, u7 ZCOPY$ Y4 ^5 Q8 T$ M8 r
To view the components of a script, use the show command and the name of the cluster script, for example:
+ S) E' @- Y6 w* |7 u6 d9 n* G2 P/ T& \4 N2 g+ A% P
crm script show mailto2 t7 @( l8 P7 b: W' o; q. P/ M4 M- Q* D" s' {
mailto (Basic)* H# D/ @- m% Q& _# e; J
MailTo
9 F; D. h  Z; _0 D' t1 U2 ?! {0 y, k* N( m
This is a resource agent for MailTo. It sends email to a sysadmin
6 }+ L- f8 [  I! ewhenever  a takeover occurs.
$ n6 o0 j6 w3 \* x5 r1 x- P  _5 {, @6 N) d3 S: U
1. Notifies recipients by email in the event of resource takeover0 k! h. r8 [& _. m

% R. m8 b! l5 S9 t) j# r  id (required)  (unique)3 |( h! ?; p( n! [4 [
      Identifier for the cluster resource
4 |- l- M; t& z. s  email (required). X. o. v# K+ R! u2 ?9 ^' I" N
      Email address7 z' ~# r$ f% k% _1 j
  subject, Y. y! \4 s% j6 v9 D
      Subject
6 S6 l4 ?5 r2 k7 ^; ^( {4 |COPY; X; j* p# k2 ^3 e  A
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.) j& e7 S6 p5 t% f. J1 ~
& W) b: T+ m3 e2 V3 E' z) M, R
Each step contains a list of required and optional parameters, along with a short description and its default value.! [% d. B( X: e

3 B) Q1 o3 @& I, T3 B" B( hEach cluster script understands a set of common parameters. These parameters can be passed to any script:- W8 O6 |; m$ n5 S! A  l- y

7 O+ _4 N6 \" \: L2 E  ~TABLE 7.1: COMMON PARAMETERS
* D; [7 U4 T- n# V  X
9 B+ ?0 W7 X; Q# o" E) T; IParameter        Argument        Description
4 P% @; X& k% J" q1 Q' m( F. Haction        INDEX        If set, only execute a single action (index, as returned by verify)
( l. e) i! ?* D- R, Vdry_run        BOOL        If set, simulate execution only (default: no)
* ?' x9 Q- M: n) U% Y( xnodes        LIST        List of nodes to execute the script for) z5 Y6 ]: Y- N& Q! X' e
port        NUMBER        Port to connect to6 ]/ z) L; @* Z9 H7 J( r
statefile        FILE        When single-stepping, the state is saved in the given file
! l2 J( b7 f' N0 ~; ?sudo        BOOL        If set, crm will prompt for a sudo password and use sudo where appropriate (default: no)
9 R1 z! D2 ~5 {2 ?8 v* Qtimeout        NUMBER        Execution timeout in seconds (default: 600)
6 `0 P5 [2 I9 \& B* \/ P- huser        USER        Run script as the given user
8 f( m* k; J* {) G6 F$ D& c  A7.1.5.2 Verifying and Running a Cluster Script/ s6 ^* j% H: e$ u

) C/ T* i% |/ y: C0 {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.* y, F' l* N0 ~

' V: X3 c5 m( @0 V+ p( `3 s: iFor example, the mailto resource agent requires a unique identifier and an e-mail address. To verify these parameters, run:
/ X  U3 T% _) H& Y, o# T" y2 Q. G3 x
4 x& A; ~+ P' `7 t# n) i( _" J4 _crm script verify mailto id=sysadmin email=tux@example.org: v/ p5 }6 G1 `( k/ X
1. Ensure mail package is installed0 k( F8 ]' C  c' i/ y

: k2 ~# S/ F6 _        mailx5 |+ c: {$ N2 W3 I0 q8 X6 O- A$ ^7 k
) t3 t8 L9 h& f: h
2. Configure cluster resources! D% o7 l$ E9 n# Q3 h; G1 d" g
, A9 o4 }; M( S8 \
        primitive sysadmin MailTo, o, G7 k8 m, J) l+ O8 b
                email="tux@example.org"
# z/ D2 T& P  Y3 f; e, u1 u                op start timeout="10"
8 Y6 [5 |4 \( K                op stop timeout="10"
1 [  O& W* C1 j& g                op monitor interval="10" timeout="10"1 m7 o  B8 S% d( W
9 N, z6 p, w- e' U8 S1 [% e
        clone c-sysadmin sysadmin
/ T' M0 G# [& S2 p( z3 o9 eCOPY0 r8 A& \! v' P; Z; U" }
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:
) Z1 _5 ]$ \- z; X
& `0 F" m+ @& a3 `crm script run mailto id=sysadmin email=tux@example.org' W; T8 Y6 [: q7 [, e9 L
INFO: MailTo
' f1 d# @( O( g' m% fINFO: Nodes: alice, bob# Y: \" ^: c7 k2 ?# K
OK: Ensure mail package is installed, L  J8 S  K+ @# W. V. `
OK: Configure cluster resources9 c" ^: l0 r: `( Y; x
COPY
3 j8 H3 g$ V/ V  o) `Check whether your resource is integrated into your cluster with crm status:8 b& C! ?7 ]. D" B9 j

/ _  d. u& O( q+ T) X, c) T( Ycrm status
: d0 ^( P  m% R9 F3 s4 V$ V4 A[...]$ X8 e8 P( X3 G5 m/ S
Clone Set: c-sysadmin [sysadmin]
6 ?& w3 }- P) F  d. h1 l3 E     Started: [ alice bob ]
. r5 Q  H5 G2 @7 Y& aCOPY
- l7 r9 v$ ]: D" l* E7.1.6 Using Configuration Templates- W/ h( H1 I. l" K

% f0 u9 _" J" |NoteNote: Deprecation Notice
7 ]! `) k0 b3 \) f: \* MThe 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”.
7 N$ J: M/ u: ~5 \8 n, D9 O% B& {4 u7 w( H2 a( C. R. v) @$ k
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.+ f: c8 T/ A2 Q# P2 g

& b5 g0 X: u. I" ]' _, `5 `. gConfiguration 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., f/ L( w# |, F- W, I& P. L9 {
6 |& {3 i  B1 X- }' M5 t# x
The following procedure shows how to create a simple yet functional Apache configuration:
, @: B; T1 c, x% A
! L8 D" `1 I3 t- @: XLog in as root and start the crm interactive shell:
1 p1 O/ x* G) ], t: B
3 s4 i# L0 \) j- X" xcrm configure
0 t' r' b! Q1 DCOPY
8 X( S6 [- ^4 z0 Z  D( Y) vCreate a new configuration from a configuration template:
  S# E* J" m# i% A: k$ k
9 Z& z& Y& U; T9 t5 cSwitch to the template subcommand:
' R& N- V5 n% U3 y
  S& Q( x' `+ Y1 t5 ?template
* |* J  |/ a5 q% lCOPY5 y, I8 r. E* F- V0 M) r2 N$ C5 x
List the available configuration templates:
6 k9 E( S. a& {$ S8 x: N, a0 i: s3 p( I1 k, J0 G
list templates% v( |4 C& r  ]9 f0 `
gfs2-base   filesystem  virtual-ip  apache   clvm     ocfs2    gfs22 G7 `8 ~+ X  ?6 l; n, r" T0 F
COPY
: @* j7 g; O) l( P. I. jDecide which configuration template you need. As we need an Apache configuration, we select the apache template and name it g-intranet:
, B+ `. B$ I: \$ l8 d
; V9 o- w* S; z, A( H2 Lnew g-intranet apache) l: ^3 R7 Z3 a6 W7 y; P  [4 w
INFO: pulling in template apache1 B  {1 K1 l2 `, w' }7 a' ?
INFO: pulling in template virtual-ip
3 j- D5 `6 `! T% K0 QCOPY. t9 k9 g' j6 `  O
Define your parameters:
, X# [" q# Y' \0 w& q3 \' _
: n6 L/ `+ V# E- ]4 I, g7 S" nList the configuration you have created:
' T: y/ ~+ y% @" m3 o
) u; P& [+ @& X( klist
( |& A1 f/ ]/ P, U5 U' v6 m' Jg-intranet
7 j2 i( Q1 j8 rCOPY' Q5 @/ D! V4 r" Z
Display the minimum required changes that need to be filled out by you:
2 l6 a/ m) n# v1 V  |" e2 l
% D/ B! I$ s8 L) H1 {/ c/ Wshow
7 M( F4 g& y/ ^, Y. H. m7 Y+ GERROR: 23: required parameter ip not set
  R$ U: n' j8 K" RERROR: 61: required parameter id not set
! A' @- x8 g: I/ lERROR: 65: required parameter configfile not set
9 F2 c7 p# y4 E! z8 z5 RCOPY
/ W" r3 S7 O1 Y# c9 P3 ~Invoke your preferred text editor and fill out all lines that have been displayed as errors in Step 3.b:
' z: }$ r" ~, \7 w
- q2 q4 E9 Z' `edit
1 V3 O* \, H- R5 F+ @) \+ D0 C  ACOPY$ x! @% y0 f- Z5 |, l
Show the configuration and check whether it is valid (bold text depends on the configuration you have entered in Step 3.c):2 `! c! G. j& s# y: _1 H
' ]. K$ D. l3 [" V
show
* e5 Q$ y* \7 F6 L: g" @9 _  fprimitive virtual-ip ocf:heartbeat:IPaddr \, D9 j4 v; ]  L/ R4 @+ n3 @
    params ip="192.168.1.101"' ]9 }& _/ |. v' x* y8 P
primitive apache apache \1 U' Z( \) [" z, h% C
    params configfile="/etc/apache2/httpd.conf"
1 O2 J$ y' g) U' s. `7 G    monitor apache 120s:60s" Z% u/ I5 y3 S, Q: C
group g-intranet \
# H1 z+ Y2 G) `  X3 D( f    apache virtual-ip  E. M2 ~$ n$ {) G
COPY
4 t6 R% U) D% s) B* jApply the configuration:; V3 a5 \% \/ a( V; N1 z

7 t9 v, |9 \7 I/ B# B4 m5 s" {apply& b5 U7 e' G+ v+ T  j$ W
cd ..
; u# {- w3 L+ O# \! A' B& Y# nshow, D: K- V# e8 \! j; k+ t$ a
COPY
) l! ^' g2 k; k- ^" o7 ~, DSubmit your changes to the CIB:: Q  Y+ i: \7 M: F* |$ M! n: Z9 l
3 C- B3 f% B7 |% A, _, {5 c
commit1 g) L5 F, T2 R6 f" ]8 `
COPY( L- }/ d. c3 T5 {, q0 V
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:
$ l/ \, V0 @0 G+ {" l$ m8 Y9 A
% S7 }4 y9 Y1 A3 W) ~crm configure template \4 ^- T& t& J+ {; s. G) z
   new g-intranet apache params \
3 u: B" u! u6 }9 S0 H0 e1 H   configfile="/etc/apache2/httpd.conf" ip="192.168.1.101"6 T7 Y* T# c' ^: O4 _
COPY3 g5 J2 n: I6 r9 J8 o
If you are inside your internal crm shell, use the following command:! o" m5 P' \/ I- l$ J  ~

2 R2 F- P# |9 _5 _* H* inew intranet apache params \$ s$ B' w+ Y0 W
   configfile="/etc/apache2/httpd.conf" ip="192.168.1.101". Y% |0 ^0 d* U6 M& v
COPY4 B  R9 A) F( R8 k( S. S
However, the previous command only creates its configuration from the configuration template. It does not apply nor commit it to the CIB.
0 S8 ~( I9 f1 y4 [3 Q: w$ b- T2 v( U% P6 w
7.1.7 Testing with Shadow Configuration" a; B3 r1 |, i4 i4 y
; Q7 u3 ?+ r& Y
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.
& y" |* f2 C/ `! g
$ f! e3 ~) ]+ N( B: f) f( SThe usual process looks like this:
% s, o9 [$ _) E2 X9 `8 C$ _( Z/ J! g( z
Log in as root and start the crm interactive shell:
- k- S, D9 C+ \$ [& Q7 F
6 q5 m& j2 p7 Ecrm configure
% @' P# u! {, |9 JCOPY. V) J2 P, H% B/ P
Create a new shadow configuration:
, l9 D& W/ _2 S) Q( g( q# i6 D0 z* T% P, X; b
cib new myNewConfig
6 K2 m" ]& C% }1 SINFO: myNewConfig shadow CIB created
5 }/ c/ r/ U6 D  q8 S+ y/ SCOPY8 x/ ]( `6 J5 Z
If you omit the name of the shadow CIB, a temporary name @tmp@ is created.
5 _# i3 T* `  h0 B- g5 X
$ d& t; j. E5 uIf you want to copy the current live configuration into your shadow configuration, use the following command, otherwise skip this step:
& {; Q2 C& k, m  S# H' |3 y9 a3 s  ]% Q
crm(myNewConfig)# cib reset myNewConfig
, Z7 O; i% w+ j" G* `3 xCOPY7 ]2 M7 u3 f" t0 B& T' A- R
The previous command makes it easier to modify any existing resources later.0 W& O# ^. I6 R3 F' E: c* v
9 |9 y) I* z$ D2 Q5 x. w
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:
* D6 o$ w6 q* P  M; _# |
& }* \7 E/ e! j" M6 Z4 Gcrm(myNewConfig)# commit
9 P5 C7 O' m7 U5 RCOPY
9 a0 D) {0 i; c' u+ x1 m' C$ FIf you need the live cluster configuration again, switch back with the following command:. Y4 H9 M# T& g  P

5 G7 w' n. `8 G# D2 Ocrm(myNewConfig)configure# cib use live
4 s- f4 @; ?; ^! p$ T8 R" zCOPY
; R' _- S. W- @7.1.8 Debugging Your Configuration Changes
% f& y% [4 L- U) K6 x5 a6 U. P9 w+ Z+ s/ R
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:4 k' L) G6 ?3 e% K

" ]3 p( N9 h: S" t7 t: ^! h$ D' i8 Ncrm configure
+ }7 Q# U9 ~, W8 L' [+ dshow fence-bob! [5 |( w1 A* r5 I1 v3 A5 k6 E
primitive fence-bob stonith:apcsmart \
: r% ]6 @+ B* {/ v6 g        params hostlist="bob"
1 B3 i5 ^. ]3 Hmonitor fence-bob 120m:60s
: ~, k0 b, J' Z2 m2 wshow changed
# t' b/ E& @3 U' wprimitive fence-bob stonith:apcsmart \
: D* B5 B& q3 F        params hostlist="bob" \
! e$ }- _: r, a        op monitor interval="120m" timeout="60s"
' g0 Y6 k' P% x" zptest
2 [5 T7 ^. _8 G; p& E" q# q5 Hcommit
9 V) ~/ O2 H- \7 S) d8 U# ~+ B# v) BCOPY
4 G2 N4 `! a+ ]0 M& t  u7.1.9 Cluster Diagram
6 B5 ]" Q$ o5 ~" E( \9 }0 ?; E
1 L0 P. t$ U5 Q5 Y9 e' WTo output a cluster diagram, use the command crm configure graph. It displays the current configuration on its current window, therefore requiring X11., }9 X7 @6 W0 ]: y/ i
' N+ s+ U% E) D2 C% r+ b6 p
If you prefer Scalable Vector Graphics (SVG), use the following command:
$ O1 {. `+ x$ o6 X8 ^  A/ `4 T6 ?' J) W4 z5 s+ R) x0 }- L$ W
crm configure graph dot config.svg svg
& v! B1 W& `! c3 w' k  F& g; c5 iCOPY% D  H' `8 E7 A5 z5 t
7.2 Managing Corosync Configuration" ?. K6 P8 b' d6 r: w, l& ?

  `* \4 n- H2 X. Q& Q  H( N: oCorosync is the underlying messaging layer for most HA clusters. The corosync subcommand provides commands for editing and managing the Corosync configuration.( v1 j2 e9 W1 Z# w  b" l& H
4 W, i+ {; ^3 G
For example, to list the status of the cluster, use status:( h# c, c1 }$ {- z! @4 D: L% }% y

+ w8 N6 U1 k, E5 jcrm corosync status' V& X" X- g3 C3 |
Printing ring status.5 E* p' j/ p7 l% W- [/ e
Local node ID 1757043630 ~, i- F; ~8 ?9 U
RING ID 0
: `+ Y5 y4 m1 m8 u( Q- v        id      = 10.121.9.43
; U+ Y8 q" X" Y0 V" M        status  = ring 0 active with no faults
. L+ |* M2 p* R2 J% J% uQuorum information; N: V7 a3 X" |% F$ n3 U
------------------
) o: o' B) y7 D- gDate:             Thu May  8 16:41:56 2014
6 E9 ?( j, b. o, z  UQuorum provider:  corosync_votequorum$ u0 N6 N; |( ~* m) A
Nodes:            2
+ o; w$ c" ~9 ~/ M7 I2 fNode ID:          1757043636 B9 ?# X0 [% l. \# O5 j7 h3 B2 g
Ring ID:          4032
7 f& |7 |. Q0 ?, B1 [Quorate:          Yes% H# }; a5 u0 z  \, m# U( c! E" o/ e* h
1 u& a8 v2 t  P) J* T. M+ \$ X9 ]
Votequorum information
+ e+ Q0 `' o' h  t' _----------------------6 ?7 F* B. Z! K9 ~; L% r1 q, w& [
Expected votes:   2
0 ?, {& c* n1 {9 F3 \/ lHighest expected: 2
" d/ X0 y) x. d7 l  g% V: cTotal votes:      2& G' d2 ^# y" W8 F' v8 D, C
Quorum:           2
) ]; M: s% c- ~4 p4 }* O% xFlags:            Quorate
! l0 ~; x' e9 V7 }/ v# E' E3 v9 T, [4 S$ l
Membership information
; K1 E+ N7 h0 O----------------------5 C  A9 `( _1 H. H5 a5 M
    Nodeid      Votes Name( U% W4 M# e- \) i1 I
175704363          1 alice.example.com (local)' ]% N' D5 I& N) k: P. L+ D! X6 l/ V
175704619          1 bob.example.com
; S( |* |/ q* A4 c- b3 NCOPY1 F- ?0 q9 m; W- G. Z/ n
The diff command is very helpful: It compares the Corosync configuration on all nodes (if not stated otherwise) and prints the difference between:: m" o( w/ O6 b) \2 @
8 y7 z+ H; r5 t/ o* [( ^
crm corosync diff" G, P/ A4 @. |
--- bob5 D! E" |; J9 R7 M( f
+++ alice
' |# @% G3 S1 g1 P5 O5 n( _@@ -46,2 +46,2 @@; _1 r5 w% b' K, m$ F
-       expected_votes: 2
. I. ^3 O$ z" A: \) F$ h# N& f-       two_node: 1
$ J& b5 l9 f" t9 Q! [$ h+       expected_votes: 1% h5 s- Z( \! a1 z4 D
+       two_node: 0
' Q7 h9 C) Y/ i1 ECOPY
4 o( {# f. ]. r; ]% n0 y- l" GFor more details, see http://crmsh.nongnu.org/crm.8.html#cmdhelp_corosync.( `+ |$ c( r- ?' R5 ^
; e2 b3 W6 X( H* }
7.3 Configuring Global Cluster Options+ p1 m4 ]6 }6 x7 k/ [

; r, g6 d$ A8 p7 I5 r# ~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:* p! ^/ y# E: }7 L' D( x
1 ?" _7 V2 U9 \( S- q5 a
PROCEDURE 7.1: MODIFYING GLOBAL CLUSTER OPTIONS WITH crm
; c* Q4 B0 A& {4 R* I
% D: T; _' \' D7 DLog in as root and start the crm tool:  S  R0 r0 r7 D9 m8 [, e) _
3 l$ u) U# v2 {- S) t+ [3 N
crm configure# @' x( ^" N; M: X$ i# ]. o: i# F
COPY- y9 m- u$ Y" Q7 C- d$ P7 Q2 D
Use the following commands to set the options for two-node clusters only:
, z( N  l% S! C. N3 l/ d8 Y% Z  O
property no-quorum-policy=stop' r; s8 |8 K# B* K1 G0 j3 L1 i
property stonith-enabled=true0 x9 B& `, i* {, R6 V. {
COPY, k0 \7 J, I- W
ImportantImportant: No Support Without STONITH
, j: ]8 O+ X! R% Q9 W4 gA cluster without STONITH is not supported.
) C. e7 T: u: ^  \3 {, R# i( p* g. }8 r; Y" c, X( [1 T4 d5 K1 N
Show your changes:& ]/ o! x3 d9 {0 \+ R) n* J
1 h3 L3 F" K1 b9 y; x
show. U% N! B5 s! p+ c( A# `
property $id="cib-bootstrap-options" \9 C/ ^0 v: x2 j+ p/ Q( D
   dc-version="1.1.1-530add2a3721a0ecccb24660a97dbfdaa3e68f51" \3 q! O0 P5 q% M) e
   cluster-infrastructure="corosync" \
, X; ]& I! p( F   expected-quorum-votes="2" \1 G  d  X# e, T
   no-quorum-policy="stop" \
: s- K1 D; w9 @   stonith-enabled="true"8 u7 p% \+ r/ W6 X$ @( G/ X+ I+ X: z
COPY
9 x1 ?: C, q+ Y3 s6 p+ F5 x5 WCommit your changes and exit:
: p. h# R% E' H5 @4 G( ]- v! ], X# ~* `5 m4 F
commit+ N, K- ^! t' _  S- F# D: ^
exit4 F  C+ A/ C" [( u3 y5 ]
COPY3 o$ {- d( H( r6 V, p
7.4 Configuring Cluster Resources
9 S* p& h# K9 R$ K3 ?, {1 |) \& d/ G
( \6 u# ^# o! g1 h% Z% mAs 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.
6 u  l! z% R  `! t# {: y- ~1 v
2 @, _. B1 A2 D) oFor an overview of resource types you can create, refer to Section 5.3.3, “Types of Resources”.* b% E/ K' C4 E0 V2 o

. s4 w5 i& c* _; ^7.4.1 Loading Cluster Resources from a File
+ v  d. b' B, k  t
5 N, D; C% @9 H; K# f" rParts or all of the configuration can be loaded from a local file or a network URL. Three different methods can be defined:
6 l0 E2 I% m5 {5 W- c; j- N7 W$ t' C( g; M, D- |, Y
replace
0 D/ A- V' C8 p& U4 _This option replaces the current configuration with the new source configuration.# N* C( `, m- C1 Y  q
$ Z' {, r0 l5 {1 M- C
update0 x6 ?, ]- n* V2 U' e/ @& X
This option tries to import the source configuration. It adds new items or updates existing items to the current configuration.1 A" f2 v2 G6 L( G- {+ m+ [

  b8 }) B- l# ^  m6 I. spush3 L' W6 e" W& Q( j) {" e6 L
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.5 [" |* L$ b  X! E2 N5 G; }+ _
: Y: A6 p  b* |" m- ]2 j/ @% `# {3 n
To load the new configuration from the file mycluster-config.txt use the following syntax:
1 J) f" J: Q- Z; z; e9 l7 y" K5 J; d. P' I5 C3 D
crm configure load push mycluster-config.txt
% T) C" L$ Y4 B/ l! L  LCOPY
3 ?( S9 O/ r% v) x1 ^0 E- ?7.4.2 Creating Cluster Resources+ P$ W9 X: @' E- `/ l
- C6 r) e7 G& j" ^: A, ]
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:
8 L3 l. o0 ]' ~* E9 W/ L& J7 Y. S$ B5 Z" c- h! g
Log in as root and start the crm tool:
7 g* l2 p% f7 B' R7 E5 G9 c
5 {& q, T% d- }6 h3 scrm configure
0 K+ D. |0 J' O* X9 p! \COPY
8 L+ L" ]& c4 P0 a* ^0 vConfigure a primitive IP address:- N7 P( X) l- i1 [+ p% Y
; q1 a% m! H- I( D  J2 Z& d. ?6 N
primitive myIP IPaddr \- q8 C2 J$ E  r  q. B
     params ip=127.0.0.99 op monitor interval=60s
: C  L1 b$ |) B8 S. m5 ]# s8 [" q0 oCOPY8 j) s* m8 B/ F
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.
# Z! J6 s) c0 }# s. N7 D2 W# X* W' W3 |
Display and review the changes you have made:+ ~) o8 U$ A+ w' q) e/ k
2 p( |- l" {5 v2 J
show7 j/ h& l* O" o/ N3 P' M. l, L
COPY9 S7 b: F4 \& G- ?# i3 I; d# K: v8 x
Commit your changes to take effect:( T8 |) `& t: O) ]* h+ T. K# c
- R+ J7 l% }3 D2 l9 F3 S# d
commit
% h$ U9 i+ D; dCOPY
6 i' ?9 b# u5 O% N7.4.3 Creating Resource Templates
& h0 l; i4 J. Y; K# M" m
5 ~* x" b+ V- {5 E7 s" F8 pIf 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:! @( l- O  v% r2 R

1 c3 {9 n) K0 G8 b1 I% Hcrm configure rsc_template5 }7 b9 N. ?: I; N% \/ Z
usage: rsc_template <name> [<class>:[<provider>:]]<type>- L+ a1 i* Y/ V# i4 J( p
        [params <param>=<value> [<param>=<value>...]]  b. ~" \7 m  N: [; x! E
        [meta <attribute>=<value> [<attribute>=<value>...]]; k0 E, M9 F4 p; J- e
        [utilization <attribute>=<value> [<attribute>=<value>...]]
" Q5 v9 N, q. O4 a        [operations id_spec4 ?$ `- t* W/ v$ n
            [op op_type [<attribute>=<value>...] ...]], L+ Y" i/ U$ {9 m1 _0 U+ u
COPY+ z7 Z. A! Z1 c- e. a& G
For 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:* k  v; H, B: V) P! l( S
6 m4 B6 _, e  F! w; K4 |! u
rsc_template BigVM ocf:heartbeat:Xen \
$ u; m; @4 L- [) A   params allow_mem_management="true" \# V7 v  g$ a. W7 z) G: t
   op monitor timeout=60s interval=15s \+ ]  h- z; U0 ?# u2 f: Z' P) T: u
   op stop timeout=10m \) J  q5 f; _" |6 ]# x5 S/ N
   op start timeout=10m. `' U- Y; q/ s: k; T: Z
COPY
  H4 e' J( e1 I) b9 M. i% rOnce 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:
- ~3 W2 K1 p/ I4 A4 p8 @5 r7 Y3 O8 y+ I
primitive MyVM1 @BigVM \
, |4 m' ^2 d; t+ I/ {. k8 w% A   params xmfile="/etc/xen/shared-vm/MyVM1" name="MyVM1"
: U5 d% n  t3 {; J' @; O  N" {COPY: S) Y* O- C0 I7 P: W
The new primitive MyVM1 is going to inherit everything from the BigVM resource templates. For example, the equivalent of the above two would be:% i5 J, ]9 \7 M; S: X! {3 r( g5 ?
7 t, a7 V6 h% x( d4 B/ x/ ]
primitive MyVM1 Xen \
1 H* \' n3 ]$ l, u1 R5 U, I4 N   params xmfile="/etc/xen/shared-vm/MyVM1" name="MyVM1" \
, F) A* d6 {" d% H0 w; V   params allow_mem_management="true" \
6 o6 u2 y4 ]- W$ Y# [$ k# h   op monitor timeout=60s interval=15s \
' u" u9 s' i# n# V% ~. B   op stop timeout=10m \
/ u6 O' y  p( U& X# C0 V# J& i' o   op start timeout=10m8 A) ?, n) t; {1 ]( r; M$ C7 z
COPY
) y( Z8 h- k6 ~1 ^3 s& E! K8 KIf 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:
  m: T' ]- d# Q5 U& R2 e+ A: s0 m
( I1 F0 g7 i6 dprimitive MyVM2 @BigVM \
9 |" k( m8 l! F/ f; F4 \8 z4 s8 p   params xmfile="/etc/xen/shared-vm/MyVM2" name="MyVM2" \
6 V4 c5 ]* ?+ ?& t   op monitor timeout=120s interval=30s
( _0 y7 V5 k; p7 M# ECOPY" n8 ^1 \1 C# Q$ d+ ?) c
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.  f" \/ M  \  R3 {7 P, k
1 S% e- N& o# L0 W8 X/ @' Z2 ?& ?
7.4.4 Creating a STONITH Resource" ?& e0 |+ }9 N6 n

! D& H$ t) Q& L9 E" L6 V2 R' o' ]5 WFrom the crm perspective, a STONITH device is just another resource. To create a STONITH resource, proceed as follows:
' {$ m6 S$ z' w7 y* s  R; X
( j' p% j' M9 l2 ]5 r. |Log in as root and start the crm interactive shell:
( E9 p9 I9 v4 E) ?5 B
9 @9 i1 ?- N/ b+ L% ?0 wcrm configure/ ]" \3 [+ I( L: ^5 @+ g; p
COPY
+ c3 T6 S% q. FGet a list of all STONITH types with the following command:
( p; [% w3 t. W" t- ~) T7 i& I, g
8 [; A. d% R! k' q& E1 s$ H  |ra list stonith
5 u# z3 ~3 ^, S0 c, R6 I$ B& Dapcmaster                  apcmastersnmp              apcsmart, h/ A6 s  L, L+ G9 G
baytech                    bladehpi                   cyclades5 T) F! t  R9 G. q6 G. V4 E* S
drac3                      external/drac5             external/dracmc-telnet5 i9 N& U) N( d
external/hetzner           external/hmchttp           external/ibmrsa
; G3 l, V/ K7 B/ a7 p3 Pexternal/ibmrsa-telnet     external/ipmi              external/ippower9258
4 w$ s4 |" A) r2 X* A* zexternal/kdumpcheck        external/libvirt           external/nut
' m) Q9 X( m3 M# K! cexternal/rackpdu           external/riloe             external/sbd
; a3 q6 Q- T) j; H1 ]6 U  yexternal/vcenter           external/vmware            external/xen0
8 |8 W& ]% F) \# iexternal/xen0-ha           fence_legacy               ibmhmc. @8 B. f, W" I, K: E
ipmilan                    meatware                   nw_rpc100s
! C) r/ a, i- B3 n1 ?rcd_serial                 rps10                      suicide
+ Y, N; H. @% E- z# F# s6 Z; \+ e6 j3 swti_mpc                    wti_nps
+ W! J6 y- A: P9 MCOPY
8 a0 J2 I9 z$ {; |Choose a STONITH type from the above list and view the list of possible options. Use the following command:
4 _! C! K( S4 x, n8 O* W
3 _( R: S0 I. @/ g! W7 c, Ora info stonith:external/ipmi/ ^) h2 x$ v% {9 T( z
IPMI STONITH external device (stonith:external/ipmi)
: K6 |; d! d4 _$ w% O( i9 Z
  q% k. Q8 X  o2 f  mipmitool based power management. Apparently, the power off
, O. ?% F  p" P6 o/ X5 amethod of ipmitool is intercepted by ACPI which then makes' L8 W% ~; B. _1 S8 m# T- d
a regular shutdown. If case of a split brain on a two-node5 K% d! U4 o* \$ N# Z2 x) g
it may happen that no node survives. For two-node clusters
' i. x& R# p1 zuse only the reset method.% k. U; f. q$ ^- t/ `- L) x6 i

* F/ U) S5 e6 a* g" J9 FParameters (* denotes required, [] the default):
" |3 G, n# ^! h: Q
2 n8 U, x( n: b' N! ehostname (string): Hostname
" p0 w9 |: M2 j3 m1 W    The name of the host to be managed by this STONITH device.
, Z( [& h8 W$ \/ l1 N/ }...
1 W7 J: l* e* QCOPY% o* G2 A0 \: [! o1 U$ H
Create the STONITH resource with the stonith class, the type you have chosen in Step 3, and the respective parameters if needed, for example:
$ o! T# K6 q- [- G1 t& d5 [- ~
. N2 F, K8 S( i* B9 q+ Uconfigure
' @# z8 |( h* [primitive my-stonith stonith:external/ipmi \, J' q+ A! l" ]. V1 m5 ~
    params hostname="alice" \4 J0 H# D, I; c% \* }6 a# S5 _: i
    ipaddr="192.168.1.221" \4 _- i0 o4 J& n& Z
    userid="admin" passwd="secret" \- j" M! N9 l# p% ^0 a
    op monitor interval=60m timeout=120s# h" P- k. ~( n
COPY# u3 a# V* X* v* e4 M
7.4.5 Configuring Resource Constraints
, c& Q! _' h: S- x. @0 h. D
( X  X5 s3 W# V# zHaving 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.
! L& i$ j2 z/ w: x# D3 t" N
( @! B" w3 V8 v6 S0 a* WFor more information about constraints, see Section 5.5, “Resource Constraints”.
0 v4 q: V. O# r9 }/ h( B5 X& P. r2 H8 Y9 M, E
7.4.5.1 Locational Constraints
" c  ^# H; k1 w) w! E) N! v% D3 p
9 _: F# y7 X1 sThe location command defines on which nodes a resource may be run, may not be run or is preferred to be run.
2 C) V4 Z7 \' N; U( @# B1 c
' v$ g- l# w4 }( Y' ^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:
) Q( a/ i- r7 g6 A! ^! g- T
6 J6 a9 f8 p$ Clocation loc-fs1 fs1 100: alice5 k% X6 J* S; u
COPY
. I% ?8 u) s+ T8 FAnother example is a location with ping:
3 h% E& G$ b- m" k$ ]4 \( m% L2 O! H
primitive ping ping \
4 }+ F; i# }5 Z8 \( x- m( l8 g    params name=ping dampen=5s multiplier=100 host_list="r1 r2"
- t; U( x! A0 J7 {; wclone cl-ping ping meta interleave=true
1 u0 s4 }7 v! a: c! n. [$ Klocation loc-node_pref internal_www \
, g! ]. e. w, T# t    rule 50: #uname eq alice \; p2 _9 g# ?  p" z' v0 w3 ~4 z
    rule ping: defined ping
$ c% j2 H' a0 d8 NCOPY
( ]( o. \  I/ |. O1 m% G8 hThe 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.
/ i3 I7 q; \& s2 T* {. n( ?8 F/ D8 N8 P# J" Z
The following example creates a resource set loc-alice, referencing the virtual IP addresses vip1 and vip2:
6 n( B2 d* x+ d; a% \' D! b7 K9 p" c6 D$ I- v2 {  N& I
primitive vip1 IPaddr2 params ip=192.168.1.5; M3 T3 M3 m" O3 [7 ]. R0 F
primitive vip2 IPaddr2 params ip=192.168.1.6
8 d; z. ]% ^$ r$ [0 Flocation loc-alice { vip1 vip2 } inf: alice
, E. y# n1 p1 P$ [0 jCOPY
/ v- m* k% M1 i" r9 I! x* tIn 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:
+ Y! j" o1 [7 p: }7 k) N( N6 o& v% r: \
location  loc-alice /vip.*/ inf: alice
$ o( e) v- T; v( ^0 `COPY
, e0 e1 ]6 M! }3 _& H7.4.5.2 Colocational Constraints
( S4 I' ?% ^' `7 v2 S7 m
4 V$ [. h) f4 qThe colocation command is used to define what resources should run on the same or on different hosts.
' q  R+ f; @+ D) h/ y+ T. l- Z8 I0 h/ K! d$ w8 R4 z# F8 k
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 `6 h6 G% ?, a. o! p( P
+ v" l0 N2 ~$ U" Z% n: s. a
For example, to run the resources with the IDs filesystem_resource and nfs_group always on the same host, use the following constraint:6 h! f5 O  [7 m
0 s8 D( s3 p0 f) u1 P4 J8 w% }
colocation nfs_on_filesystem inf: nfs_group filesystem_resource
/ I# A/ }0 P0 ?* k8 u+ mCOPY
/ _. O1 Z5 o' s/ ^For a master slave configuration, it is necessary to know if the current node is a master in addition to running the resource locally.
$ [" z" a" y  A0 S4 A% l+ X) f1 ~
6 C9 d6 e* t6 f7 F  ?7.4.5.3 Collocating Sets for Resources Without Dependency% F$ h' ^+ ?4 K2 c# u/ p

8 |) ]8 t8 e- GSometimes 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.7 M1 C& `/ U/ h
7 C/ x/ B0 j; ]3 a* f
Use the command weak-bond if you want to place resources on the same node, but without any action if one of them fails.' d6 S; R& R* {7 o7 P

+ f0 y# D7 C# S6 X: Jcrm configure assist weak-bond RES1 RES2, T9 f" _6 \, y  B& v
COPY
7 x9 t2 Q* p( cThe implementation of weak-bond creates a dummy resource and a colocation constraint with the given resources automatically.# L3 L/ Y& X2 E6 `
: ^2 `4 O+ D. P/ Q- L0 D; `. Q/ X
7.4.5.4 Ordering Constraints
2 r. `* y' P6 E8 x$ P9 d9 {- x+ i
' O+ J' g! t; BThe order command defines a sequence of action.) Y6 P# ~/ H3 T# u
1 k9 B& o/ H0 o1 z2 x! `3 D  |
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.5 s0 j) b, c4 r+ `) g

7 R- K" F0 M/ yUse the following command in the crm shell to configure an ordering constraint:
8 J7 X/ P: |9 S6 Z. @) J0 c9 z7 ?+ ]6 |% I7 V" T7 P  j1 m% s
order nfs_after_filesystem mandatory: filesystem_resource nfs_group
" o8 V8 X, K8 c* zCOPY
7 a- y, ~; V$ n: Q1 S/ M7 z7.4.5.5 Constraints for the Example Configuration; q$ g. b, W0 T8 }% B$ b3 X

/ q% q" K. z7 r& mThe 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:( E; f  B+ @7 Q" ~. w, E6 F
/ T2 _6 c8 @& X; I7 K
The file system must always be on the same node as the master of the DRBD resource.
$ e8 L( Z$ X1 k* M- \' f9 T  _6 z. ?' d" i. v
colocation filesystem_on_master inf: \
9 E% F. c8 u  Q/ e: _# H    filesystem_resource drbd_resource:Master* c  ^0 A2 G5 g; z! E( u5 S
COPY8 E/ ~; v2 o+ G% `
The NFS server and the IP address must be on the same node as the file system.( W& F; D* ]; z' F! x1 _2 c$ D
2 ~# M7 G4 R4 y4 e; M1 R
colocation nfs_with_fs inf: \
5 U: E2 S# N; Y$ \2 t" R   nfs_group filesystem_resource
% c9 ]. y' o! q) G: H1 xCOPY5 `! D3 R. X  \) g- W' j# E( f3 V
The NFS server and the IP address start after the file system is mounted:& ~; Q; M/ ^: P) Y' s: f
9 c0 D$ [* G/ s6 M0 W/ T1 T4 U% v
order nfs_second mandatory: \( q7 l4 X( H0 e4 H* P1 H
   filesystem_resource:start nfs_group
' N# T& d: g; o5 ~COPY: h# v/ @# P9 L  p
The file system must be mounted on a node after the DRBD resource is promoted to master on this node.
, s9 a4 J1 p1 d5 G5 v2 H1 D: s- Q) ^6 I+ m4 @/ u& l% T) |) `
order drbd_first inf: \
! I% Y$ t# p. ]5 y    drbd_resource:promote filesystem_resource:start
; D" r% l' G) m0 H" _: u+ G) r* pCOPY; X, h& A% S; b8 D- {
7.4.6 Specifying Resource Failover Nodes
- C  W1 h8 P+ }1 Y  ]7 R& P( V+ d2 p. |4 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:  T: M) o# c- t
% C% w- i1 |4 R, H0 r: p
location rsc1-alice rsc1 100: alice
5 }2 f6 C( A% W# s) K; N9 ^: aCOPY+ ?7 z" p6 I) C+ C1 [
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.
, c4 K5 ^3 |- w6 `% H( |( O6 k
3 A; m) U3 H; R- V, |; x( \( cStart 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.
& x( r/ y4 t/ F3 D% n9 E& ]) E& x8 w* W5 |
For an overview, refer to Section 5.5.4, “Failover Nodes”.
3 K' h* k$ p4 Y6 h* h3 H4 Y2 B& T4 ?, t$ H
7.4.7 Specifying Resource Failback Nodes (Resource Stickiness)/ r2 H- C) Z! H) D# V- m
5 h& V; F+ ?0 ]+ }( \& H! ?
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.
3 O5 m7 y+ h3 Y  ^8 y; q8 F  k: ?; C) O8 J: {" `
For an overview, refer to Section 5.5.5, “Failback Nodes”.* U6 [8 b, ?4 W( q+ |% j
9 [9 f( P* D& f% A+ i6 H
7.4.8 Configuring Placement of Resources Based on Load Impact
( w  i9 M! P# U8 Q: `% m; _) E8 L* |2 u1 P
Some resources may have specific capacity requirements such as minimum amount of memory. Otherwise, they may fail to start completely or run with degraded performance.
, [8 g* g1 d: b' X
% |# _9 E/ e5 F; t* B0 ?0 wTo take this into account, SUSE Linux Enterprise High Availability allows you to specify the following parameters:4 n, m1 }# @& f
/ c! M# t3 B3 a) _, M1 }
The capacity a certain node provides.
8 q) P3 t7 [! {: `, `, B
% P3 _2 j. K+ g3 T9 [( H5 AThe capacity a certain resource requires.( J6 h. K1 ~5 v8 |1 x
, N9 ]* K- V3 i. D+ J
An overall strategy for placement of resources., z8 F% }3 _0 @0 Y- `  O
, H# n# [1 D5 g) N7 U: U4 E
For detailed background information about the parameters and a configuration example, refer to Section 5.5.6, “Placing Resources Based on Their Load Impact”.
  v& F" e; E, O; |5 F1 b. g6 D7 ~& e2 ]
4 [% Z2 X* n, {5 W. J- wTo 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.  x8 [5 I, h# B
* P4 l: r: z7 @+ M: R, F, @9 b, g( l
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.) ?- ]4 y5 J: Y& [+ r

9 _1 s. ~# d2 ^; Y/ g: wPROCEDURE 7.2: ADDING OR MODIFYING UTILIZATION ATTRIBUTES WITH crm" p( |. ]7 B  M2 S* \4 l

, l! h5 {& r; W% o  h/ U& T1 ZLog in as root and start the crm interactive shell:
  u: b* l# p5 l( B) D$ m( e" `( T0 d. f/ n& e+ S, l
crm configure
* [: x: `& H0 t+ kCOPY
# L, q2 F, G- T5 nTo specify the capacity a node provides, use the following command and replace the placeholder NODE_1 with the name of your node:
  ~* }3 g0 ~9 K" i- _! g1 k, ?/ a6 L; h% R# f' q0 |( p9 |
node NODE_1 utilization hv_memory=16384 cpu=8
) |- J8 F+ C/ Y2 S3 Z: ^/ uCOPY" E/ {( n5 @2 u! G  R" p
With these values, NODE_1 would be assumed to provide 16GB of memory and 8 CPU cores to resources.
: U: X, n& X. c+ [# y8 \2 v: U
9 o. f$ \6 w  _To specify the capacity a resource requires, use:
# g$ {  k2 \' {$ v" d) G( l( w) n7 [# N# B" h
primitive xen1 Xen ... \# s" b' t9 v# a- F: l0 w
     utilization hv_memory=4096 cpu=4( W. z/ V& k# `. W4 c
COPY
: k  ^5 _- c* D, g% w( WThis would make the resource consume 4096 of those memory units from NODE_1, and 4 of the CPU units.
+ m  S$ R+ X6 [( S) H7 {" }+ Z! F# V; m/ i* V
Configure the placement strategy with the property command:+ u3 s/ T' o& O

4 c+ R. |) a/ Mproperty ..." u7 r" i4 v# G3 u0 [6 {$ A
COPY
. T( t! l5 E, ]2 P& }: N9 _6 aThe following values are available:5 R3 Z; w" E' |7 L( w

+ `5 d2 T% q! y4 [2 Kdefault (default value)
+ P; {8 Y& q5 n* {Utilization values are not considered. Resources are allocated according to location scoring. If scores are equal, resources are evenly distributed across nodes.
5 h2 @/ c  B6 Z6 n7 _
8 `) x. @2 P: z  nutilization2 l9 n! o2 y* Q: y: ~4 A& l; j
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.' _( N' b/ K2 K. W, j4 j; i* [+ y

  s5 G8 q  o3 h0 b. L) |minimal
  k( S3 w( G, H; q  fUtilization 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).: I6 t4 V& i' @2 z* q3 X
  F+ K1 h+ |' I; ?+ {7 {
balanced6 |6 Y; }  A" Y7 B
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.1 k! @* M8 O$ o) T% p

5 I+ y- c7 B3 s" [' U2 A7 ^NoteNote: Configuring Resource Priorities
2 n' I) M- \' r) m" v$ V" y( 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.
8 z. Q" n" s  R6 j
7 N' W& L! G5 `: t' i2 [& [Commit your changes before leaving crmsh:
1 s( c0 S" s0 Z' m( l
$ [% K1 g2 O" M+ hcommit
9 [8 p# F; g, E5 F2 N/ {- {COPY
7 K9 u: y4 I  t  n' v" bThe following example demonstrates a three node cluster of equal nodes, with 4 virtual machines:
7 x8 X4 J0 R" ?" Z, R1 z" J$ A. m) p2 C* |0 y; a
node alice utilization hv_memory="4000"
8 b1 G/ c2 Z: Q' Fnode bob utilization hv_memory="4000"
, T$ ~. {7 L4 \! M* d. S) d/ rnode charlie utilization hv_memory="4000"
* w. o1 p$ ?& c; ?primitive xenA Xen \
6 w+ d' \+ ?0 v# t# h9 J1 G. v    utilization hv_memory="3500" meta priority="10" \
- q) l6 \8 K) C, P    params xmfile="/etc/xen/shared-vm/vm1"
; X1 h. ]# F4 R- u- _, uprimitive xenB Xen \
" M' [) m3 L9 d1 m0 l2 M    utilization hv_memory="2000" meta priority="1" \
% c5 r2 Z2 ^+ k) O6 |2 L0 t    params xmfile="/etc/xen/shared-vm/vm2"4 q. N) e- \4 ~
primitive xenC Xen \7 F0 X  x6 c  c
    utilization hv_memory="2000" meta priority="1" \  w) w' |: M" W* b4 B* @- F
    params xmfile="/etc/xen/shared-vm/vm3"
7 R/ `4 c) a3 j  Pprimitive xenD Xen \- p. r$ m/ w* ~" z! Y# C3 {. h' m
    utilization hv_memory="1000" meta priority="5" \
) f0 {! q7 ^9 V+ V% U/ p    params xmfile="/etc/xen/shared-vm/vm4"
% W) y" s* u) r  Uproperty placement-strategy="minimal"7 ?. S6 d9 H: F7 o% P& B
COPY1 D/ F1 Y0 P5 r. i4 V
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.
# L, k6 M. N8 u' k3 r5 m
: L% g8 a5 L6 G5 C" r" e& a( sIf 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.
8 X+ A4 g! L/ n- T
# W* \' a2 {9 U+ d8 p+ b# S2 D7.4.9 Configuring Resource Monitoring, Y$ J7 A  V5 @- Q
5 c( k7 k4 ^, t3 U' V1 m4 E
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:
$ d  h" y% P- p) Y) B5 S9 n- b4 v& G% ^2 K2 M7 t
primitive apache apache \+ F7 F4 D* w' O, R5 r! L9 H" m+ o
  params ... \, s8 {. Y- ~0 ?0 E3 j2 C
  op monitor interval=60s timeout=30s
' A2 ^: T' ?/ I5 j7 DCOPY
! V2 D3 I* W% l  q( AThe same can be done with:3 A& H% ]- W! Y8 j1 u- K

9 v0 h. L, K' t8 b7 Rprimitive apache apache \! u5 y* y! Q* ]9 |- C/ o" O
   params ...$ Y; J* ?  l# V) \# R1 m6 M6 |
monitor apache 60s:30s7 E/ s5 K6 y/ r2 R$ a1 S
COPY# X( l( V* L( |3 o8 L" ]$ q
For an overview, refer to Section 5.4, “Resource Monitoring”.1 Z0 v! _& @' I% E7 A( M: P
" D! ^( B! D& f6 s7 T! W
7.4.10 Configuring a Cluster Resource Group
) R+ x5 j0 j( P* i0 }9 ]8 w4 m7 N+ M, V6 h3 m# z, S
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):
# I3 O4 D4 r) j, e( p2 o0 h" [$ i3 e- M$ m2 h- y+ ^
Run the crm command as system administrator. The prompt changes to crm(live).4 H( {7 ~( D) y$ e4 L1 z/ j5 a4 d

# N2 ]4 a4 M' l; c0 d, f+ I4 cConfigure the primitives:
0 B8 F: d2 p$ F9 L1 \5 R4 \, g; G8 Q/ t4 R9 F. }* X' h9 n, Q
configure
/ t% F# c2 W" R  vprimitive Public-IP ocf:heartbeat:IPaddr \
, F2 e( n3 G- {) W$ A   params ip=1.2.3.4 id= Public-IP
5 d4 Z+ T, L5 [9 u; J! |primitive Email systemd:postfix \2 _- F1 v4 ~: J6 ^! P
   params id=Email
$ E9 m- H; ]( o) C/ D. pCOPY
5 x# ~+ c4 D% G$ ?# [Group the primitives with their relevant identifiers in the correct order:$ p2 x1 }1 j: [3 V7 |. ~9 P7 i% J

! w% V* k5 y2 @! agroup g-mailsvc Public-IP Email( w4 w' @; D/ P9 Y$ D% r* |/ p
COPY
9 D& A# t! }1 H8 g7 O$ |% rTo 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):  E/ K8 U% U) K. d
7 c$ O' O' L: I/ f5 I5 }7 r
modgroup g-mailsvc add Email before Public-IP9 L/ Z, N3 K( T  T
COPY% U8 ]2 b# j9 `) V
To remove a resource from a group (for example, Email), use this command:
3 f2 D  U9 y- ^" s' ?; j( \3 D& p3 `* C0 e# _
modgroup g-mailsvc remove Email7 R% _- |7 V- H  Q' H
COPY
  ~0 S9 w+ n9 k4 RFor an overview, refer to Section 5.3.5.1, “Groups”.! m: w% E" b" f! r- R) o, c0 \
4 [) O7 L0 t" a$ m' q
7.4.11 Configuring a Clone Resource+ ^4 ^6 C! ?( z+ ?$ ~7 T. Q7 _

  E' }7 Y$ ?2 `* ~3 xClones 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.
6 C3 W+ Y1 {/ t9 @, Z  U
6 k2 z) C$ D0 u9 lLearn more about cloned resources in Section 5.3.5.2, “Clones”.
& e3 Q; g& q; A3 s5 n! B. ?* w  r% S& |9 f" J$ t5 G* H
7.4.11.1 Creating Anonymous Clone Resources3 n; F) a. g8 I  l
3 Z3 a( l: o* z. P, w
To create an anonymous clone resource, first create a primitive resource and then refer to it with the clone command. Do the following:
4 @% h  y: G0 m3 g5 Y+ V) L! S- ?' y; I4 ~1 k  v. k
Log in as root and start the crm interactive shell:* i9 |) \& a( F' m

4 h5 g5 q1 H+ k1 jcrm configure2 U( m# `0 y8 S! d! B) K
COPY
+ C: Y/ Z* @( f5 Q0 ]0 L/ `6 _- TConfigure the primitive, for example:
  _/ j$ t$ }; o& d
2 P$ c& q+ a* `' P, h+ L0 Dprimitive Apache apache
2 Q. ?% S/ U1 R/ k3 z  wCOPY
1 |* e5 S$ t: H; R& ?1 ?Clone the primitive:7 \' G$ V6 g$ ^
; K4 }- |: e% z8 ^$ C! ^: x$ [" r4 I
clone cl-apache Apache9 B- R; c8 ~9 I9 \$ R$ ~$ @
COPY
4 _) @( s3 N; ], `; s. F7.4.11.2 Creating Stateful/Multi-State Clone Resources: {/ x9 E5 C- l# }/ ^# i! ~

& N) Y: o* a) N5 CMulti-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.* \' Q. _! m8 [- P  F7 O
7 |6 x. ^9 @7 n4 C
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.
# V  q+ T! F) N0 X( H1 j
0 I$ @% e: n) A; v; D+ \Log in as root and start the crm interactive shell:
- r6 f; X) q: K3 K6 o: `1 A. h/ o! K  |; t
crm configure
- y* }7 B$ J6 i; iCOPY
! W1 }8 [) N1 `: @0 p2 t6 `3 _2 S# E  IConfigure the primitive. Change the intervals if needed:
/ X; `3 q) d! s$ a
& ^, L1 y+ w  S: U! vprimitive my-rsc ocf:myCorp:myAppl \
- w, D! ^) Y2 \    op monitor interval=60 \
: v% N, X- f4 z, k$ z# o. d. g    op monitor interval=61 role=Master
. P# Q! q+ c2 D& w" w! d1 mCOPY# X3 M3 y& V2 |5 I  V+ o# s' e) f
Create the multi-state resource:
# Q+ E; o4 _6 e7 ?3 I5 i
7 i. @1 }9 b( j$ s9 M) Ims ms-rsc my-rsc
& I* G- ]* {' s& \COPY
; V- H1 `) [4 d. ]7.5 Managing Cluster Resources
) v  Q" X3 R, H9 H' M  U3 x% a) i' H5 L5 R% U' M2 b
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.
9 i& S# F+ F1 p0 B7 X9 F* V2 }# p! v' z0 s" c/ T! u
7.5.1 Showing Cluster Resources' D# R. R9 Q% M' `8 l1 |7 l1 `
) _. w' ~6 o" d- _) F- M9 k5 c
When administering a cluster the command crm configure show lists the current CIB objects like cluster configuration, global options, primitives, and others:! f$ T6 ?; Q3 {  T

" B/ D: F: W) I) l6 ~* bcrm configure show* i  k, q( H2 X% [8 w
node 178326192: alice7 b2 s- E# c# a
node 178326448: bob
  ~$ K9 ]0 d  Xprimitive admin_addr IPaddr2 \
" E) G+ A' ?' U/ M        params ip=192.168.2.1 \
/ I% ~7 C) T& x        op monitor interval=10 timeout=20+ ^% z3 e" U( C* s3 V% `; E
primitive stonith-sbd stonith:external/sbd \; z0 G3 C! W2 G5 b$ Z
        params pcmk_delay_max=30
: p# O* o7 Q2 g4 Z6 nproperty cib-bootstrap-options: \
; q  J3 Z. V" L% v% }' ~5 n        have-watchdog=true \
+ d3 t9 ]8 {6 e& E/ t+ g/ z1 R        dc-version=1.1.15-17.1-e174ec8 \8 R  g5 i& g5 ~+ J/ z# `# @: [
        cluster-infrastructure=corosync \. M9 ?' K# v$ [" N
        cluster-name=hacluster \
1 o9 K" d- u- O* V  F. [, x5 d        stonith-enabled=true \
0 m3 g4 h8 _# D+ G; `& U+ T1 b        placement-strategy=balanced \
) M+ v" I1 V5 v        standby-mode=true7 e" |% v5 T1 Y5 u/ T% l0 X
rsc_defaults rsc-options: \
- N! ~3 X8 u1 n1 B  d1 O  v$ r7 ^7 N        resource-stickiness=1 \
) X* [& c) ~6 D) y4 [1 p1 s        migration-threshold=3: e7 F- C  e, }  M0 D# |9 E
op_defaults op-options: \% v- D; c1 s# b( k- p- p
        timeout=600 \
# }' ^) B# V) z5 p        record-pending=true, ~; g# n5 l/ _+ e
COPY
+ e* d- p3 G7 M! |+ mIn 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:0 z. a) h! ]1 x$ b" h5 q
7 G  g( S% Z  i
crm configure show admin_addr4 e) Q. ?8 \! L1 ?4 k
primitive admin_addr IPaddr2 \$ l) ^2 H' E- v0 t* j: L
        params ip=192.168.2.1 \: I# C$ [  f# c, y3 G4 R
        op monitor interval=10 timeout=20  B: P+ U% Z9 ?; g2 U* {( \; \4 q! t
COPY
. p6 t5 }% g4 k  IHowever, 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:
- `0 U& u0 G8 M2 I; e+ L; S: o$ B# J9 _
crm configure show type:node
; }. q1 x+ i; N* i$ L6 A# ?4 M/ hnode 178326192: alice/ P7 v& m# q8 @5 L
node 178326448: bob
% \8 B; B- z. Z' J$ lCOPY
+ o- P7 G7 Z1 w  {9 QIn case you are also interested in primitives, use the or operator:, S5 L2 w- O  q; b7 u$ W  U
" f( b, z9 h0 Q7 m. N+ M4 p
crm configure show type:node or type:primitive
9 V& @$ ~7 l" Q6 z* W* lnode 178326192: alice
! s! ]0 P" g2 F- Gnode 178326448: bob+ X$ c2 w$ c" ^8 }
primitive admin_addr IPaddr2 \8 r' }, n( z$ i: u0 l1 V; v: G
        params ip=192.168.2.1 \
" K8 N! B+ ]/ s8 z  O3 R        op monitor interval=10 timeout=20
( K( [# I, L8 _7 D9 s0 Tprimitive stonith-sbd stonith:external/sbd \
5 s. _7 H, j- E5 i$ x        params pcmk_delay_max=30% y( W  V, X# h5 F5 \! K2 P0 M8 l% r
COPY, o% [4 Z3 I" H3 h; q# U& r8 Q3 q. j
Furthermore, to search for an object that starts with a certain string, use this notation:$ L4 t: M! r! {: j6 N5 h

  p2 `- G3 m" Q) u6 W+ `$ ~crm configure show type:primitive and and 'admin*'
& r  |' ~+ V; D0 m7 s) i- e' Y/ xprimitive admin_addr IPaddr2 \
) A* X9 a+ M8 Z% _' K4 T, g" w        params ip=192.168.2.1 \
) r. b$ G6 A! S6 t2 X        op monitor interval=10 timeout=20
3 R/ H1 m/ j* M+ q4 u' o; x( ^COPY' i$ d' \' O# ]# @5 ]+ A
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.$ M9 E& v# b+ n* p" ^+ a

. j# |: f; T6 R- m& [; B7.5.2 Starting a New Cluster Resource* ~9 N( a! ?9 E- s5 M. R- e

! l6 D. ~3 h( C1 sTo start a new cluster resource you need the respective identifier. Proceed as follows:
. N& l; t1 r- J3 E
6 i( ^+ ^+ h$ Y1 s) j. A3 y( yLog in as root and start the crm interactive shell:) X# l0 S2 [4 l2 B4 G

4 |- k/ F0 F6 I8 o. N' _crm
: R& t* r" E0 R  w. a2 dCOPY
" I, M5 }+ U8 p) [6 g' F% XSwitch to the resource level:0 `2 E) y& ^( X; x3 [
' B6 E/ U; L" g$ @4 {
resource& g4 I+ j1 U& ]' j. I: F
COPY
2 }0 [2 s9 }% `- t' |/ JStart the resource with start and press the →| key to show all known resources:% U+ J8 C, Y4 R5 G6 ?/ u- o

7 e( R6 b7 W6 e4 W. v! Estart ID$ G6 T. a+ Y8 S3 s7 C0 q  c9 h) \
COPY
, t7 _. x# ]' v  p7.5.3 Stopping a Cluster Resource
+ c" G8 r4 i6 l9 `9 D' F; k- w5 [) }& [" J
To stop one or more existing cluster resources you need the respective identifier(s). Proceed as follows:& |7 I4 L8 U8 M8 M; E
9 p7 p/ ^. Y9 u# A( F- W  F! _
Log in as root and start the crm interactive shell:. ]! S7 K% P- t$ O3 j: _
8 u; d( b& F# K
crm+ o$ d8 m0 C1 Q5 ~% D. Z. [
COPY
& C. f- p' O  ~1 E6 q) x2 BSwitch to the resource level:0 y6 ~' H6 S; n, I1 c; R$ ?+ ~: P

* h8 V. I+ x: ~' ?0 ?resource2 ^4 p5 c( k9 `! X4 M
COPY
% Y4 Q$ ^: G: ~Stop the resource with stop and press the →| key to show all known resources:9 M& t6 _9 W1 p; t" b0 n

% c0 N4 z" M7 k1 X5 p# Nstop ID; c, K/ M+ J/ C* B
COPY
, Q9 C1 K6 B% r! eIt's possible to stop multiple resources at once:9 b6 ], `& q) Q* s$ g; {

, O. J' w* L; X4 k$ _6 f: z! a; qstop ID1 ID2 ...  ^! R( Q" \9 g4 V
COPY
% d& G4 ?9 E5 M: p3 Y! ~7.5.4 Cleaning Up Resources& I, \+ H7 p# Z6 ^! ^
, t* t1 Y  H7 J( t
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.
9 ~% c- f! D, f) t; \4 o) F/ t; \+ j  V: l* L
Open a shell and log in as user root.
+ F! m6 R' Q- u4 A( R. V: j# K! ]6 S1 T
Get a list of all your resources:
( U2 u! u4 Q8 n, c% b( A  p3 |" h0 P- k3 {4 ~* V$ `1 W5 c
crm resource list# x. O" ]3 T  q
  ...
/ h+ c0 y1 t: ~" @+ ~2 DResource Group: dlm-clvm:1
) e% y% ^* \3 ?! U" P( n" j* m! V! B         dlm:1  (ocf:pacemaker:controld) Started
6 _% o( G: `  Y+ Z3 I! i! ?         clvm:1 (ocf:heartbeat:clvm) Started
, Z5 V! K' o" ~: X9 ~COPY4 d! t, d+ E+ S3 d( {+ G$ n/ K
To clean up the resource dlm, for example:9 c, w+ A1 r; p% a9 w6 g' }
5 k& a! X% q( d8 X* x
crm resource cleanup dlm
3 c2 r- b( f! uCOPY
3 v* Z- B% X1 C6 ^8 ?1 i7.5.5 Removing a Cluster Resource
; R" y. u  V! b6 O9 K" D
( T0 a/ G4 h7 ]3 Y+ o2 d# kProceed as follows to remove a cluster resource:6 H! Z$ x( x5 |& N+ ^% v
8 a' O: v/ e) K- y1 y8 G2 V
Log in as root and start the crm interactive shell:5 @% z- T2 U+ m6 {
% Y  A/ Z! H8 ^/ z  a# j  p
crm configure5 _% P; ?3 ~; I+ r& d( n: R
COPY
% f/ j2 d( \+ W  HRun the following command to get a list of your resources:2 @1 K7 M$ a1 T3 D# T' ^# k" v( y

4 V/ l7 u7 K+ d+ y' }& x+ J) Qresource status
+ D7 g2 D, |, nCOPY
- B# |: M! V- z3 F' p2 ]For example, the output can look like this (whereas myIP is the relevant identifier of your resource):
/ ~! h$ i& v3 N. x
3 _. o" F5 M% e* qmyIP    (ocf:IPaddr:heartbeat) ...
! R& j  C" C; u* f4 A) LCOPY3 I. r' Q3 @6 b6 k- l- }! \
Delete the resource with the relevant identifier (which implies a commit too):# O4 D  |, S) _1 c3 {1 A' [$ {- w8 Z
' A1 g  B: _0 ], M
configure delete YOUR_ID+ u( }7 ^% s; Z* H) g$ A
COPY2 n; S0 r2 e; }- E
Commit the changes:  i2 f. o, u9 `4 d- W8 E" o: f
1 B0 x9 P4 h: q0 L
configure commit6 C0 m9 k! h5 F" r( ^
COPY
* T2 K; i5 C/ Y7 ^2 K( n7 G9 e7.5.6 Migrating a Cluster Resource
1 F) u/ g4 B1 w. _( e6 R1 H2 D% c) a( O1 Q1 b5 X
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.0 q; u0 e0 ]% X: A4 ^9 U2 n

+ ^' L: a! \/ P# X; W+ PUse the migrate command for this task. For example, to migrate the resource ipaddress1 to a cluster node named bob, use these commands:1 H  A. W9 g& p6 n7 P5 B

& P3 {* c5 l% D2 w, Fcrm resource
# K6 e. l. Y& m1 H: K3 A" [migrate ipaddress1 bob
' o# `) I7 _5 u& g& e3 zCOPY7 k$ f. j# m* E9 r
7.5.7 Grouping/Tagging Resources
9 w; y7 K/ v, [, A3 v% y+ ?  R* A( S7 Z
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:% K' D" ^( h$ o' A

! J  X8 W. O# e, `' \7 Z& Icrm configure tag databases: db1 db2 db3/ Q: j+ a3 f3 X5 F2 A+ q4 d
COPY7 E6 Q" f# |' x* d" A  M
This allows you to start them all with a single command:& W  w7 o0 ?4 p# i1 P
7 B8 t- p1 q3 @- |- ~' o
crm resource start databases
( B+ A6 \( D% C3 t- B* LCOPY
+ W: c, i  M6 T) c3 \5 O% dSimilarly, you can stop them all too:
  q9 P9 C: t% l7 ]
7 h5 P% @- D/ r0 n6 G: O  C8 x1 ucrm resource stop databases% `3 I; u: w5 p/ e7 C8 M
COPY/ ~0 ^$ ^7 ^7 U" P3 C% a( N- c& p
7.5.8 Getting Health Status; M9 _$ g. @  z4 _9 O; W
1 ^/ R4 D+ |" C" N  M8 i
The “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.
. p% Q  Q; c- Q  t. `8 k. I1 G0 w; e7 ^0 i7 F( \( [* A$ @! G
To get all the details about the health command, use describe:
+ R; I/ q5 E4 ~$ c$ I& w2 a& n! @  F; A% r; S, B1 s$ e
crm script describe health
1 b, D$ c! f1 p4 I7 eCOPY
0 g9 p4 M! F3 G# N( T0 i( JIt shows a description and a list of all parameters and their default values. To execute a script, use run:3 d3 z  f4 v- C( ~' c2 E2 Z( ]

6 U4 w$ X1 e" b7 L) |$ b7 Xcrm script run health1 N& z, k/ N/ [
COPY# L$ Y2 Z9 A; o2 }' |/ I+ i2 A  A
If you prefer to run only one step from the suite, the describe command lists all available steps in the Steps category., ?8 l+ F3 p$ L" A( v9 M1 ~7 `

5 ~" _" U  M0 H/ `( DFor 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 t/ N" b5 z$ z# i% B3 e
" F8 Q8 Q' F6 F; w7 q; h! J
crm script run health
) i& \" g5 o* w; l, R) G- m: n    statefile='health.json'  f, D# p  N& I& X
COPY
9 [, z/ o, G) T& t0 QIt is also possible to run the above commands with crm cluster health.& w) W8 a# [, O2 S* L

- C, _% N# P+ t2 U+ Q0 CFor additional information regarding scripts, see http://crmsh.github.io/scripts/.0 D, D# m5 ^1 c( O- L# l% f
6 |& ]0 h7 _& v8 a$ a6 Q! `0 P
7.6 Setting Passwords Independent of cib.xml
  _6 }3 b/ ]% c4 A7 |& o4 @
- q8 F/ e; X! O# kIn 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.- N' o3 A: p, ?, h
, ?; {- c8 v! M# s6 v; l3 D8 K1 X; I7 q
Before using secret, better run the show command first to get an overview of all your resources:
* o( ?% C$ c2 _2 j8 Q7 Q3 d* C. V( {
* o+ M* n) m7 X$ J. Rcrm configure show
( h+ N- `& j4 X! ?: K( Kprimitive mydb mysql \4 I/ S/ f* H( t9 M3 n; F$ C- C
   params replication_user=admin ...' ^" G+ h0 m, q+ ~' F- P2 O
COPY
1 x  G& v3 t  j% N5 S* y- `  |If you want to set a password for the above mydb resource, use the following commands:
. d- n' c# E8 B% D
5 ?0 ?/ D7 e1 m* Hcrm resource secret mydb set passwd linux; }+ a: \% B  U2 e/ Y
INFO: syncing /var/lib/heartbeat/lrm/secrets/mydb/passwd to [your node list]8 M. H5 d9 Z6 I# r% ], W) s: l
COPY6 j- W; p3 {! }  R, Y8 U
You can get the saved password back with:5 Z0 }1 a) b1 I9 ]7 E0 s: m0 m/ o; O7 d
" u$ c0 l( K4 @: E
crm resource secret mydb show passwd
! N/ j& g# G2 x" _- C3 r# j1 j. Tlinux
5 o1 u9 ~6 d5 p8 U, ^COPY1 t- h" T. K* Y( |3 L
Note 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.
% |9 F$ O) c2 a' t
, k7 `' z. k- ~/ G7.7 Retrieving History Information2 w  [+ @5 v1 E7 x3 ], p
& h' }6 |* M4 o$ w- 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.! b  R3 c: |. T6 r  F6 S8 U

; n) a+ u6 z1 pEach cluster moves states, migrates resources, or starts important processes. All these actions can be retrieved by subcommands of history.
7 R% A1 m) d+ g4 V( v
8 i* w0 ?+ C, Z+ b4 Y' |  nBy default, all history commands look at the events of the last hour. To change this time frame, use the limit subcommand. The syntax is:3 f$ _% P' w: {! x! v

$ E6 k& R& T* G! H. i, Qcrm history+ Q  i; h% [, F" t
limit FROM_TIME [TO_TIME]
% g9 t$ b/ \! C- w2 |: d2 W8 Y% U% ACOPY
3 U' ^$ x9 c- O9 bSome valid examples include:6 f. l& F) Z. i- S4 L3 y/ D

$ @% S* @6 X4 K  _) F: `: Flimit4:00pm , limit16:00* ^# p& m  p3 A, R$ B
Both commands mean the same, today at 4pm.
* q( s, w$ v8 ^
7 V5 Y6 i# c) k) H* R  N' d( n* [limit2012/01/12 6pm
5 _7 B, n: ^' {: m" d3 N9 YJanuary 12th 2012 at 6pm
7 e8 k9 G! V6 k9 ^& W# M
+ g% `* i, h2 ?; {+ S: F8 Qlimit"Sun 5 20:46"
7 k* {- \6 K6 `$ N  }& iIn the current year of the current month at Sunday the 5th at 8:46pm; z" x! l9 \5 x/ x( c$ f& r+ V
. n: I; ^  _" G
Find more examples and how to create time frames at http://labix.org/python-dateutil." y$ [: g1 j, P3 H

2 n+ p: Y7 {  K, `5 bThe info subcommand shows all the parameters which are covered by the crm report:
7 @0 e7 ]( e4 K
$ v5 m, f, W0 H7 O" {& zinfo
; d; t" ?9 b8 V' [: {8 h4 sSource: live
6 {" O3 m$ C* f6 y6 k4 M$ |7 iPeriod: 2012-01-12 14:10:56 - end
/ k2 @9 @% i+ G( l) T/ ?3 \: k1 ENodes: alice
5 Z$ j- |7 W' g5 v/ G) `Groups:# K+ |* t# P2 i$ I0 q+ ~. d; {
Resources:7 k" x& E. w) n7 i7 W9 c; t6 M# z
COPY  t6 O1 X/ d. x: w5 b$ k
To limit crm report to certain parameters view the available options with the subcommand help.
/ F' l. f- h7 \! u1 s$ V3 o1 |* H  z& A, d
To narrow down the level of detail, use the subcommand detail with a level:  j+ m- B3 t" y+ t
2 W) D6 B/ t# d* \, D+ P6 P
detail 1
" d+ U$ T* q0 x4 l; `0 i& Y/ HCOPY
8 L$ @8 q9 t' h- IThe higher the number, the more detailed your report will be. Default is 0 (zero).& V9 N& e) z3 Z
4 V8 g) \! A/ Z/ b
After you have set above parameters, use log to show the log messages.% k, ]4 Q& q7 O' W1 [* n" k8 H
: m* [& k# L8 z( \% b
To display the last transition, use the following command:1 o. t- K  ]( r1 Y5 H( @

( I8 N1 R4 U8 Wtransition -1
7 \) K4 g9 r) R2 YINFO: fetching new logs, please wait ...
$ f: g. c+ u) v8 M! Z7 L" `0 sCOPY
  u. s: m5 X6 [" j: |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.* C# G5 ^! G: _5 C8 I% z  S

8 B- O& r3 u1 M& y6 ~If you do not want to open the transition graph, use the nograph option:2 S' T5 {$ e7 L) d9 B/ Z
2 j; Q0 \& K) Y/ y
transition -1 nograph; f8 u, ^: c4 I9 ?
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

站长推荐上一条 /4 下一条

北京云银创陇科技有限公司以云计算运维,代码开发

QQ|返回首页|Archiver|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )点击这里给我发消息

GMT+8, 2026-4-8 21:26 , Processed in 0.072518 second(s), 23 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

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