|
|
群集操作命令3 e0 G& N6 Q$ P. p. C
7 X8 r1 p9 `0 y' X# z7 ?9 K
1、验证群集安装
1 f$ [4 S2 t+ z" P' g0 e F0 Q( u+ q( Y
[shell]# pacemakerd -F ## 查看pacemaker组件,ps axf | grep pacemaker9 D! {' U2 U1 V q ~$ A m! a
: }& S4 W5 @2 T) n8 q+ E5 X1 ^[shell]# corosync-cfgtool -s ## 查看corosync序号
: H0 v6 K, a7 X
8 y5 J- o% P' s& y[shell]# corosync-cmapctl | grep members ## corosync 2.3.x
& [1 l9 A# t( i/ I( [2 N! s8 q* ?: q1 ~( }+ v, u
[shell]# corosync-objctl | grep members ## corosync 1.4.x
: v# V! Y7 P A' o: W+ m% k9 H/ e
2、查看群集资源
+ E: A3 y+ V* d1 R/ V9 t
2 ?+ r# w5 M' b# Q& M) Z5 a[shell]# pcs resource standards ## 查看支持资源类型
# c$ R! [/ {4 k8 V' R! P
- `1 j% b, z9 v1 H, {7 M0 }' O# X[shell]# pcs resource providers ## 查看资源提供商( B1 O) @" {( ?& B0 e3 \2 C$ {1 k
3 E1 y0 y8 ~: \# B I
[shell]# pcs resource agents ## 查看所有资源代理& R9 w8 _3 c* l7 z5 q4 V$ l! h6 n2 t
) a, N! f# m# {1 @, B. b
[shell]# pcs resource list ## 查看支持资源列表
# \" I3 v. }- x' b/ u+ |
* b, V1 V. x9 `2 ?1 _; |' i. U[shell]# pcs stonith list ## 查看支持Fence列表% o. A" r$ Q& e# \- K$ c. M" `
# }+ d+ p1 W8 p9 X, ]3 \- r[shell]# pcs property list --all ## 显示群集默认变量参数
, _$ ~5 w+ _2 `3 t' n1 a3 W% h1 \: k
# O. s( h- l% x- [0 k$ ~2 U[shell]# crm_simulate -sL ## 检验资源 score 值
) K6 g3 X: o: F: ^ U) ~" p, F) [$ Z& i
3、使用群集脚本- O# F' A# }+ h2 |7 Y3 I
/ q X8 K$ H' F* [( B[shell]# pcs cluster cib ra_cfg ## 将群集资源配置信息保存在指定文件
X7 N/ Z' u: T7 g9 P# b$ C
% f+ {: a$ h( Z" L; Y[shell]# pcs -f ra_cfg resource create ## 创建群集资源并保存在指定文件中(而非保存在运行配置)7 \% w# i: N/ g8 g9 e
7 i) c! c& i; ?& i, J[shell]# pcs -f ra_cfg resource show ## 显示指定文件的配置信息,检查无误后6 k; i0 ]& C0 S: u
# g0 q: q& H* q[shell]# pcs cluster cib-push ra_cfg ## 将指定配置文件加载到运行配置中
, O2 v! L5 H! l$ j8 a
2 S' x/ X0 x6 S% D( }4、STONITH 设备操作
8 `# L+ u% c' J4 z# y8 O" l5 i; h( i
[shell]# stonith_admin -I ## 查询fence设备
K+ s, O0 G$ v! `* z( ` Z3 `2 y& A# R( E1 D4 \, T" S# H$ k
[shell]# stonith_admin -M -a agent_name ## 查询fence设备的元数据,stonith_admin -M -a fence_vmware_soap& F& w4 t0 u& |7 Z! S& N' g! ~, [
. p, n# ^' i9 W7 F# |( A[shell]# stonith_admin --reboot nodename ## 测试 STONITH 设备9 g9 p! B4 }4 N+ ]% m
' ^. B, H7 @2 y& a5、查看群集配置
8 e" C5 N+ l1 H$ c
: b* h$ f7 K) S1 {0 g# o4 f6 z[shell]# crm_verify -L -V ## 检查配置有无错误
) d" c3 V/ o( i/ T, h; h% N4 H
8 T# _% @$ j4 O: x! K0 h[shell]# pcs property ## 查看群集属性
$ L: j0 q( M! t. o, e* o, J8 ^# } [ K8 o9 |9 u
[shell]# pcs stonith ## 查看stonith( o+ q4 U8 ~) r6 c+ _
+ {" k, ]5 H8 T: O1 R[shell]# pcs constraint ## 查看资源约束6 n8 v6 p" J0 c, n' W
9 m% Y8 v& i+ h1 G
[shell]# pcs config ## 查看群集资源配置; R, M$ G* ]" M* @1 m
. Q' g1 n- j6 q: b3 T[shell]# pcs cluster cib ## 以XML格式显示群集配置
4 o' [4 E/ g5 s% ^. c4 o7 h( i, a- ~; v( h
6、管理群集
1 _( `! }& q4 K2 w) _
9 b* S8 X7 E# m& S. O[shell]# pcs status ## 查看群集状态
1 P/ O& g6 R. s/ I! y+ S" t, T
/ o+ a% q* h8 V6 F- y/ z$ s+ d[shell]# pcs status cluster# O) Q' e( G/ P
+ Y U; m' i$ I% u! I# i8 h[shell]# pcs status corosync4 Q, C* C7 N% h
% j1 s3 A P# _3 F+ W7 T
[shell]# pcs cluster stop [node11] ## 停止群集
1 X) r5 G; T" M9 [6 C( e3 S) F. {" X7 [) R) q
[shell]# pcs cluster start --all ## 启动群集- T. q$ l/ O% d) }3 l. d5 X. s" e
/ ~- Z, _( e& L3 W$ K2 m
[shell]# pcs cluster standby node11 ## 将节点置为后备standby状态,pcs cluster unstandby node11# C, F) U. d0 m* _) E
$ z1 o- {4 U7 c2 i
[shell]# pcs cluster destroy [--all] ## 删除群集,[--all]同时恢复corosync.conf文件) J5 y- K p6 g1 a
0 i# ~: }4 P2 D$ f
[shell]# pcs resource cleanup ClusterIP ## 清除指定资源的状态与错误计数
- x: j2 j6 Z$ T7 ~, T: F$ K% l' N2 Z1 u7 H
[shell]# pcs stonith cleanup vmware-fencing ## 清除Fence资源的状态与错误计数
) M6 p6 H7 o" _: S- i6 x |
|