|
|
群集操作命令
- U& @/ f+ b: {& @, z
3 P! u4 D& s/ x0 a4 n3 d1、验证群集安装
/ a$ g9 q3 s+ v0 w9 a) O. n% k$ H% s, N4 a! T9 P. m; x6 w3 Y3 G5 Z$ x
[shell]# pacemakerd -F ## 查看pacemaker组件,ps axf | grep pacemaker6 x C% |/ D% ~; V
7 h% |- H" x% t6 X. \! _* [
[shell]# corosync-cfgtool -s ## 查看corosync序号
0 O& ?# W, W8 @$ H% r7 x. E k, A# e. H) O( E2 ]
[shell]# corosync-cmapctl | grep members ## corosync 2.3.x
$ x4 }3 R8 A7 M m: t
$ J" L' r0 a$ n5 I- V2 e3 q9 s, Z O- F[shell]# corosync-objctl | grep members ## corosync 1.4.x
4 X$ R$ r/ `. u& j: A1 Q8 j5 |1 D. O6 Z7 {
2、查看群集资源; k3 H8 g9 N* S# c
" s* z+ ?: Y$ R1 ^
[shell]# pcs resource standards ## 查看支持资源类型0 p2 v: x2 a! _( t# L/ s5 b
- w" X8 q) K0 H; E[shell]# pcs resource providers ## 查看资源提供商
: [+ z, |( q8 M8 z
9 O8 v. _7 F( k/ t. a7 f6 ][shell]# pcs resource agents ## 查看所有资源代理# G( X& m5 b3 h7 k$ j2 i
, R' O1 K' E) N. V4 n[shell]# pcs resource list ## 查看支持资源列表4 B6 w* H( @% t/ j, o' j
: [& h; a/ @6 D
[shell]# pcs stonith list ## 查看支持Fence列表/ `% l; _" z7 H+ u
; r) I( n& A# P1 a3 M" {/ d[shell]# pcs property list --all ## 显示群集默认变量参数* w! e) q; y2 P
2 l4 y. s4 g: g/ L( F
[shell]# crm_simulate -sL ## 检验资源 score 值
+ M4 P9 E, ]& G+ H. M6 y% [ V& [& B4 [4 Y1 m8 ^) D- Y3 B$ a: ?
3、使用群集脚本+ t( \" c- ]0 k; a* q/ J
" f) x* u! \0 g2 _- p$ G1 z- M[shell]# pcs cluster cib ra_cfg ## 将群集资源配置信息保存在指定文件
; f; ^1 h; k5 Q( h! X' Z
" |! F) j. [- R7 M6 w7 j( y- N" g[shell]# pcs -f ra_cfg resource create ## 创建群集资源并保存在指定文件中(而非保存在运行配置)
' B- f+ l p [/ s! G! F
. N% ^4 C }1 ^2 e/ `3 }2 t: R$ {[shell]# pcs -f ra_cfg resource show ## 显示指定文件的配置信息,检查无误后9 |, D, \& V. `; U! w) e! a1 g
% O: d0 F+ j4 u- Y% R7 U+ i
[shell]# pcs cluster cib-push ra_cfg ## 将指定配置文件加载到运行配置中
8 U) ~+ Z* ~8 w) m
3 O; F3 Z8 h" V& p" f4 z; a' |4、STONITH 设备操作, E; O: |: r; j3 Z4 S
0 e) n. G, v: U( y8 k[shell]# stonith_admin -I ## 查询fence设备" a) |% i: M2 i% A
F k9 D( s8 |* B" m# b6 s[shell]# stonith_admin -M -a agent_name ## 查询fence设备的元数据,stonith_admin -M -a fence_vmware_soap
% Z6 r- J# p) Q* ^8 y' O6 M' Q. |0 y3 g
[shell]# stonith_admin --reboot nodename ## 测试 STONITH 设备1 e1 a0 O n1 }: k
+ k5 \' L/ x/ g# [" p. j, q5、查看群集配置* t$ m2 D0 [4 m, N, ~4 T! X+ C
% c. }7 \& `3 t: @, w7 C, T
[shell]# crm_verify -L -V ## 检查配置有无错误
7 h* l3 N8 T5 N3 c1 i; e9 H
/ E8 |! }+ q' g3 L[shell]# pcs property ## 查看群集属性
& N- D- }! g o& N
) c* o( V. c+ M/ t' Q: {[shell]# pcs stonith ## 查看stonith
2 h' H2 D: s8 f* |& D i! R( s
, @% r- t# D* o% g L+ F[shell]# pcs constraint ## 查看资源约束- A& v' \# w* O, b: y
5 ]8 w) o5 G. P* W$ ^
[shell]# pcs config ## 查看群集资源配置
( M& x. {7 d) p6 `4 ?5 i9 ]& z) _, J, y6 {
[shell]# pcs cluster cib ## 以XML格式显示群集配置, ]& Y8 v: p& D: s
' b& K/ X7 d |0 u6、管理群集- P/ X$ |5 G" v/ U+ s
, d9 _ L, t2 w$ P H% y[shell]# pcs status ## 查看群集状态4 I$ r: ]& S3 j* {! a' W, I' @4 E
# o* f# Q" ]1 o! `* @" K[shell]# pcs status cluster1 d4 h3 L( O& q/ \+ j
/ b/ p1 L5 }6 i t( X) U5 p/ v
[shell]# pcs status corosync9 y [3 o5 f; @% d
p4 I( g ^3 t# o: c3 C
[shell]# pcs cluster stop [node11] ## 停止群集
8 b3 o J& C( @% C# `
7 |. J) |/ {' O[shell]# pcs cluster start --all ## 启动群集7 x1 ^& a8 z, y0 {# f" H
5 F; l1 Z) ^: q3 w" x. @[shell]# pcs cluster standby node11 ## 将节点置为后备standby状态,pcs cluster unstandby node11
" d2 f% s7 ?, U* Y+ i1 z( M( |/ |' Y8 \) M
[shell]# pcs cluster destroy [--all] ## 删除群集,[--all]同时恢复corosync.conf文件
9 [9 |% e2 N- k e, O% r7 B; B! K, z8 H
[shell]# pcs resource cleanup ClusterIP ## 清除指定资源的状态与错误计数
) u+ H1 r' z; A& c8 v% v
: e" d. i" N2 L4 {[shell]# pcs stonith cleanup vmware-fencing ## 清除Fence资源的状态与错误计数
7 a2 _# L' N3 O! c |
|