找回密码
 注册
查看: 5707|回复: 5

pacemaker中pcs命令的介绍

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2017-12-29 10:50:47 | 显示全部楼层 |阅读模式
pcs cluster destroy --all       删除集群
1 q8 k7 i! }3 [7 W4 K8 x$ BWarning: Unable to load CIB to get guest and remote nodes from it, those nodes will not be deconfigured.
8 f$ D6 r  p: G- R( ~controller3: Stopping Cluster (pacemaker)...
4 g# S4 o" e; P8 [1 ^/ u; A& hcontroller1: Stopping Cluster (pacemaker)...  p2 R! v( k# Y' [' b
controller2: Stopping Cluster (pacemaker)...
; P( O9 U9 i* {* ]controller2: Successfully destroyed cluster
' v! F5 S% g; ^; B. i7 kcontroller3: Successfully destroyed cluster
& Y! B& Q; @: n5 g% Mcontroller1: Successfully destroyed cluster
  c9 ]: b( E  b. H1 `; b
% ^  J" r6 N2 b& G7 i
/ \# ~) Y7 A2 A' A' `pcs cluster stop --all   停止所有集群
8 L! S! z6 y% Z. k8 m$ R) ]( e- D1 W  J% G* H; A1 \
5 ]5 B) i9 G3 x9 ?% h5 \9 k  u1 a
# pcs cluster enable --all7 M9 u" A* D3 [& b8 v0 d
controller1: Cluster Enabled: L' p* [1 e1 }6 ^' O0 X
controller2: Cluster Enabled
# `* E6 R6 i$ i6 q* T' r# U/ Vcontroller3: Cluster Enabled
- @1 P# l- h0 l- _1 A
6 y) i+ }; {: W) I; [" w# pcs cluster disable --all, p8 Y; O+ T7 @! x! ]9 J$ @6 X
controller1: Cluster Disabled
2 X% d5 Q8 |2 Z4 Q: w1 c' P3 Y$ h4 O6 ]- Vcontroller2: Cluster Disabled/ A- q( y7 S- s" U" c
controller3: Cluster Disabled
! `5 ?( O5 @. d* h8 }" q) L8 |2 v+ |: x

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2017-12-29 12:47:05 | 显示全部楼层
# pcs resource create httpd_fs Filesystem device="/dev/mapper/vg_apache-lv_apache" directory="/var/www" fstype="ext4" --group apache2 H- U: u) ]& d0 w
Create an IP address resource, this will act a virtual IP for the Apache. Clients will use this ip for accessing the web content instead of individual nodes ip.+ d% M- i: d. F0 s

# L7 Y, ~8 Y9 }( n: T& X& U# pcs resource create httpd_vip IPaddr2 ip=192.168.12.100 cidr_netmask=24 --group apache
% o! `1 v$ M% ]' xCreate an Apache resource which will monitor the status of Apache server and move the resource to another node in case of any failure.) T5 Y2 Y9 j0 m

& V% T4 Y& K9 a# B% u! @2 O# pcs resource create httpd_ser apache configfile="/etc/httpd/conf/httpd.conf" statusurl="http://127.0.0.1/server-status" --group apache
5 U! @- s, [" Q+ n" L& KSince we are not using fencing, disable it (STONITH). You must disable to start the cluster resources, but disabling STONITH in the production environment is not recommended.8 y' E9 I! T6 j- R0 p

9 D7 t# U- `3 @3 ^. ^6 W* c# pcs property set stonith-enabled=false
  ]& ^5 B: M; s. S% lCheck the status of the cluster.
4 b, B" @5 q3 C' e4 Q% }+ M3 ]$ {! s$ K: S7 ?1 o$ I
[root@node1 ~]# pcs status& L/ T8 [, F- J7 f' g. a* d
Cluster name: itzgeek_cluster8 Z1 n# b2 F$ ^4 O
Last updated: Fri Mar 25 13:47:55 2016          Last change: Fri Mar 25 13:31:58 2016 by root via cibadmin on node1.itzgeek.local7 y7 t- _4 y% i/ H! h1 n/ i
Stack: corosync, W' e4 E4 w' f' ^0 w
Current DC: node2.itzgeek.local (version 1.1.13-10.el7_2.2-44eb2dd) - partition with quorum% m* @+ _7 s% t2 b  j  Y
2 nodes and 3 resources configured
( J3 n$ I. [) n  T* Y
. Y" h9 T( m( [5 {Online: [ node1.itzgeek.local node2.itzgeek.local ]5 F5 d- e, Y9 O- ^9 s6 m

3 A( A& b/ w5 |# W3 g5 X0 T1 j; jFull list of resources:$ n4 a8 {: W5 K4 N7 G8 I! u

3 F8 V5 _( }! M) ?" Q6 }' ~ Resource Group: apache
0 y& Z0 a/ a- g, v4 _2 j     httpd_vip  (ocf::heartbeat:IPaddr2):       Started node1.itzgeek.local
4 W+ v5 p) L# a# t0 ?* q; v     httpd_ser  (ocf::heartbeat:apache):        Started node1.itzgeek.local
2 t$ S3 m% T" W     httpd_fs   (ocf::heartbeat:Filesystem):    Started node1.itzgeek.local
9 Y, @5 }( {  P8 a5 P. e; \
4 @* d: J8 `: R/ ?  Q+ BPCSD Status:( D8 x% ~% [# W5 e* i/ q
  node1.itzgeek.local: Online& R( ~; t' D  i
  node2.itzgeek.local: Online
8 l; n( w' [/ o; O3 e/ \! O3 g4 A0 t4 t" `5 H+ ?& E
Daemon Status:
  a3 d8 Q4 n; O$ ]5 i& L$ T7 z& `  corosync: active/enabled
, I. f2 W5 Z5 P+ i8 o; ~  pacemaker: active/enabled
! A7 ?( D  Y) k/ E; W8 A2 c  pcsd: active/enabled

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2017-12-29 12:47:47 | 显示全部楼层
[root@node1 ~]# pcs cluster stop node1.itzgeek.local
# k, H( x: i  o: Q#  pcs resource move apache node1.itzgeek.local! U9 \* \: N, O8 }' F' Q7 N
#  pcs resource stop apache node2.itzgeek.local: L' _7 I" z7 }  A! I
#  pcs resource disable apache node2.itzgeek.local) r% ~$ }( J! P/ I; E
#  pcs resource enable apache node2.itzgeek.local# }  k1 T) R) c! p& A
#  pcs resource restart apache

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2018-1-12 22:50:59 | 显示全部楼层
pcs status corosync
# m& Y/ ], J! n. x. W% E( v% a& K" c0 B/ t
Membership information. a8 V1 D: M4 Z- _
----------------------
: k1 w' V" I8 t/ C3 i* @    Nodeid      Votes Name
8 s  M% G- Q) M- q         1          1 controller1 (local)7 o# i/ J( `+ Z. v: }. @( Y6 `8 B" }
         2          1 controller2
) T- m* C7 u9 j) p# k; ^! E, v         3          1 controller39 J& d# c' T# @- U* L: ?
. K# h* A! E; n% a8 |6 ^( q
pcs cluster cib. K' e3 `$ g" g9 s+ F
" m* R! o* P0 _, c2 f. s: {' g& E
pcs property set stonith-enabled=true% I# O1 k3 f8 K

" t  l! F  f3 E& }pcs property, z, h5 d  Y2 U  G
Cluster Properties:9 q% Y0 C& u3 w' U) m/ R+ a+ O1 Q
cluster-infrastructure: corosync  P& V  J- c( B9 m, {
cluster-name: my_wsrep_cluster
! v: V% d  Z2 a! ]+ t) o7 z dc-version: 1.1.16-12.el7_4.5-94ff4df) H- @) r9 b; Y$ Y
have-watchdog: false: O8 w$ Z/ S' P. ]
no-quorum-policy: ignore
5 S6 |* }& u2 a" [& E+ G4 `; L& O stonith-enabled: true
, c& l8 }! J1 m: H" n  T* B
( f& v* a0 J% ]( A) R1 v6 n) ]0 w6 c/ O9 Y& M

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2018-1-12 23:02:16 | 显示全部楼层
    pcs resource show
& ?. ]. X! u4 i8 G% {      Show all resources.. f/ ?9 z2 x1 K

) A3 F( J0 R& s7 M; `    pcs resource show VirtualIP
$ ~- N& J6 R0 V( n4 _& I  g( ~      Show options specific to the 'VirtualIP' resource.$ ^! g6 V+ U- T9 m' K5 t) n
" I7 j; ^2 I' @, H* j3 ^4 l

8 A; k/ d4 o9 d: @8 s! E6 v    pcs resource create VirtualIP ocf:heartbeat:IPaddr2 ip=192.168.0.99 \
+ [( @: m' @* s# r: H0 P/ S               cidr_netmask=32 nic=eth2 op monitor interval=30s' S2 k2 w. P/ J+ |3 \7 v0 y2 s/ t
      Create a new resource called 'VirtualIP' with options.! e9 y* C8 g5 m. Y* P; k

" Z/ R- ]1 P5 i" U6 o6 @    pcs resource create VirtualIP IPaddr2 ip=192.168.0.99 \
1 K/ N) ?5 O$ B) v- m               cidr_netmask=32 nic=eth2 op monitor interval=30s
6 z( _3 M' {& i5 F+ ?, ?6 W      Create a new resource called 'VirtualIP' with options.
& S) H" L! }$ \7 y  F7 N1 |" h+ R, V, i, j
    pcs resource update VirtualIP ip=192.168.0.98 nic=
( G8 |0 h: @$ j      Change the ip address of VirtualIP and remove the nic option.$ }5 P5 O. g8 T
7 |9 f- p! x: F
    pcs resource delete VirtualIP
; y4 k  ]7 D2 K9 j, U      Delete the VirtualIP resource.

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2018-1-13 00:23:26 | 显示全部楼层
集群故障时候服务迁移
4 p; o5 O1 ?% t- i5 @7 {' @4 l
/ Y( E& d4 Y" o1 }' z # U0 G- B2 |- Q8 z& `

) A; x9 t( K, z% e# pcs resource defaults migration-threshold=1
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-6-12 00:57 , Processed in 0.018006 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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