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

pacemaker中pcs命令的介绍

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2017-12-29 10:50:47 | 显示全部楼层 |阅读模式
pcs cluster destroy --all       删除集群
( h  z- _" }* p: nWarning: Unable to load CIB to get guest and remote nodes from it, those nodes will not be deconfigured.
6 q8 g% _9 F! _( X5 J+ rcontroller3: Stopping Cluster (pacemaker)...
1 V2 l2 g+ S) i- E" Zcontroller1: Stopping Cluster (pacemaker)...
$ l7 P$ _4 E# gcontroller2: Stopping Cluster (pacemaker)...: o  F( |4 N6 w4 @) t7 B
controller2: Successfully destroyed cluster
5 p0 \5 V  r* C$ ^) lcontroller3: Successfully destroyed cluster# O9 A6 K6 R7 p- D3 P
controller1: Successfully destroyed cluster& d7 s& o( v/ X2 e! E
9 f  O) e7 E+ `3 l' W6 {' J# Z

8 E+ T0 j0 Q4 r: N9 v  n! P7 T4 Apcs cluster stop --all   停止所有集群9 Q2 t0 D& I/ W

7 H( W8 }* Y; [
9 X% ]& `# y; K* J+ J# pcs cluster enable --all- K) h! [" a' H# v8 D% t
controller1: Cluster Enabled
+ |! d% U* [2 h8 h0 A8 Ocontroller2: Cluster Enabled
$ f& O% g/ |; H- q# }7 xcontroller3: Cluster Enabled: }6 a; q4 L, o  k/ R

0 u5 q. P% q; x6 w% l6 T& G# pcs cluster disable --all
5 g( B, S) _* g7 ~- acontroller1: Cluster Disabled0 C, |' ~1 _4 O& U
controller2: Cluster Disabled
6 R" V( i( Y9 k/ Ycontroller3: Cluster Disabled8 o" z$ _) |0 t# C
8 f; x# s- X% D" ~* v( S

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 apache0 F/ O9 I- G' ~2 E  l4 A
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.% C1 k! y' l+ o5 L! q* G
$ Z' G' ?- n% s; e
# pcs resource create httpd_vip IPaddr2 ip=192.168.12.100 cidr_netmask=24 --group apache
! A4 [, m$ f2 |Create an Apache resource which will monitor the status of Apache server and move the resource to another node in case of any failure.$ n+ {1 A4 o1 P2 V) S2 `5 X# Z

$ O1 p4 \% O6 T$ a) c7 w# pcs resource create httpd_ser apache configfile="/etc/httpd/conf/httpd.conf" statusurl="http://127.0.0.1/server-status" --group apache
2 X2 G; i$ c+ |* z; H1 }Since 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.
4 }" y4 F% `9 N4 J7 a7 q
3 ^0 T/ I: M! ^% H# pcs property set stonith-enabled=false$ |6 R5 c. k) ?9 R: o# _8 |$ z; c
Check the status of the cluster.
& @" ^% f( c6 |) y' c, A; E! c8 D  Q0 @# t6 J. ^3 F7 J
[root@node1 ~]# pcs status
, Y) @3 [& P2 j$ YCluster name: itzgeek_cluster" |/ a7 f3 d3 H( k$ o/ k$ M
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.local
) y; e8 @9 p- c' I! _* z; i4 eStack: corosync
5 N6 z& y2 ^+ P3 H- c3 A  I4 a4 }Current DC: node2.itzgeek.local (version 1.1.13-10.el7_2.2-44eb2dd) - partition with quorum
1 `" R  l/ L  w: w$ @( T6 n2 nodes and 3 resources configured
3 U" n- G; y% E- C, `0 x! u5 f5 J( z" u+ e# v; k
Online: [ node1.itzgeek.local node2.itzgeek.local ]2 R  |: q# [" B: C! j( a5 f

6 e8 T& h  k$ w( {: @6 u1 F, SFull list of resources:. e! \! E0 ~+ C; z1 J, _( X
: y7 W7 C, C, b2 u+ e0 v
Resource Group: apache* b0 f1 M/ p1 X6 Y8 ?
     httpd_vip  (ocf::heartbeat:IPaddr2):       Started node1.itzgeek.local
, n- q+ j" K; G     httpd_ser  (ocf::heartbeat:apache):        Started node1.itzgeek.local9 q( G5 `+ T% l- U% U( y; ^' G
     httpd_fs   (ocf::heartbeat:Filesystem):    Started node1.itzgeek.local
. s5 H' x; M& l5 T! G$ |1 Q! g0 h
; E8 v! g7 p+ QPCSD Status:" A6 z1 j, S  ]8 ?" K: L
  node1.itzgeek.local: Online) k) [3 H: r8 B( p" \0 R
  node2.itzgeek.local: Online8 D  p8 @0 @/ ^/ w+ o
" s( a* q. c+ ~9 _# b
Daemon Status:
* h1 U* Y) c* L1 S  corosync: active/enabled5 F5 p& j$ ]) p& _, b! z! O
  pacemaker: active/enabled
- ]/ }$ p: w0 G) L/ @  pcsd: active/enabled

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2017-12-29 12:47:47 | 显示全部楼层
[root@node1 ~]# pcs cluster stop node1.itzgeek.local* [  I( T- W7 s2 p' O; k. _7 O9 C( K
#  pcs resource move apache node1.itzgeek.local' B# C: Q. e7 D
#  pcs resource stop apache node2.itzgeek.local# \2 H, H$ w7 d1 F: {9 u3 Q! Z0 ?/ W
#  pcs resource disable apache node2.itzgeek.local
- g. d9 E$ {. b9 s) @1 d#  pcs resource enable apache node2.itzgeek.local
: k6 G! G' Y6 z. ~5 l#  pcs resource restart apache

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2018-1-12 22:50:59 | 显示全部楼层
pcs status corosync( I% C$ O3 [+ G5 n0 w! v

5 J- _% r. s2 L0 ZMembership information5 k, p" Z! Y0 R$ V8 A
----------------------: d; K6 T$ g) B! y
    Nodeid      Votes Name4 z7 B, J% H) j& a  r! W. L
         1          1 controller1 (local); d+ x  i8 l) m
         2          1 controller2
7 F' {' N  |  c% r0 f         3          1 controller3
# s. w2 }' M2 D9 m; k0 G( g
3 p3 ?, K+ A' _: C  B5 t4 hpcs cluster cib
% s6 X+ R2 I) I8 H/ n2 ~) q; T1 A' B- Z2 W2 k% w1 ^
pcs property set stonith-enabled=true% r4 z, B% F, W% g, \/ A

! q8 ^- [3 g" Jpcs property
# @# l- ]6 n$ V/ TCluster Properties:$ R/ M+ }1 z$ Q( k7 Y
cluster-infrastructure: corosync
1 A% o6 W7 H' Z cluster-name: my_wsrep_cluster
0 B. P- r. n5 q: r. _ dc-version: 1.1.16-12.el7_4.5-94ff4df
8 D. k" r3 V, U8 E& Z3 u have-watchdog: false
, M( N7 |- J$ V, o$ {  g- a5 U, n no-quorum-policy: ignore9 E, _4 G2 ~" z" G) C
stonith-enabled: true
7 Z7 B! ^0 }8 g3 i
  f7 X2 F# v. s" w' W
% y. [( N" E) l$ W1 x

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2018-1-12 23:02:16 | 显示全部楼层
    pcs resource show
* N. J$ F5 G, ^: f3 M. I      Show all resources.
6 D8 U/ Z( ^; z; d& G  ]2 K$ p) x$ Z( g+ f. z. i9 V: `
    pcs resource show VirtualIP
8 U6 c' b# q, J+ e; O      Show options specific to the 'VirtualIP' resource.
% j8 f; t9 X7 N1 [6 @5 o- x! Y" B
! ]3 I+ ~/ h/ a; V
- L  Z) N+ D8 H: K    pcs resource create VirtualIP ocf:heartbeat:IPaddr2 ip=192.168.0.99 \3 t2 E  U) g& w0 Z% Q( I
               cidr_netmask=32 nic=eth2 op monitor interval=30s6 o. I9 W% ~  c3 i& S
      Create a new resource called 'VirtualIP' with options.
0 r1 G7 h" a" o
, u0 ^" e$ S* I; l5 G  n; l! Q    pcs resource create VirtualIP IPaddr2 ip=192.168.0.99 \* h7 N& \+ X2 K  z, S6 E4 [5 Q9 s9 x
               cidr_netmask=32 nic=eth2 op monitor interval=30s
. R1 B/ ?; q' y      Create a new resource called 'VirtualIP' with options." n# q5 d" w. r" T: A- p2 _2 D

7 Z2 a4 i* `) l) @4 C" p3 N) q/ p4 X' t    pcs resource update VirtualIP ip=192.168.0.98 nic=& [4 W; |5 G: q, @- d0 c
      Change the ip address of VirtualIP and remove the nic option.' `: N* N4 I( r! c+ Z$ f
6 e; {( F3 b$ G$ N9 Z/ R. G8 N$ U
    pcs resource delete VirtualIP
, B5 ]& E" l$ @. A      Delete the VirtualIP resource.

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2018-1-13 00:23:26 | 显示全部楼层
集群故障时候服务迁移
& r, p. E5 M2 M+ }- {, e& x6 n- J# v* L9 q

$ |  A# S: }9 W9 ?; M) [& U* p0 W% `" c9 p2 U9 y7 }/ f
# pcs resource defaults migration-threshold=1
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

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

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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