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

pacemaker中pcs命令的介绍

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2017-12-29 10:50:47 | 显示全部楼层 |阅读模式
pcs cluster destroy --all       删除集群
* t6 c$ c% c& \! ]0 WWarning: Unable to load CIB to get guest and remote nodes from it, those nodes will not be deconfigured.
* ^. N: q( A9 B- [( r- V6 Q- Mcontroller3: Stopping Cluster (pacemaker)...+ L2 W8 E% O+ y# T- N/ g/ }( p
controller1: Stopping Cluster (pacemaker)...
% k$ J4 n* ~0 L( V- O* hcontroller2: Stopping Cluster (pacemaker)...
* d0 l; {5 D2 _# m, A6 y7 Tcontroller2: Successfully destroyed cluster# L5 C# H, C- s: J- l# G
controller3: Successfully destroyed cluster' L4 s- k0 Z' z
controller1: Successfully destroyed cluster% A% L; n) z' J3 O; G

! a- U9 [2 `# _3 V( z* O, w
+ c" T0 z2 ~  e4 vpcs cluster stop --all   停止所有集群
7 k7 D$ m" _$ @7 U8 i7 r  n9 s; _
2 {0 x- X0 f8 X: P7 r6 J
% r! I, _2 U3 r3 `. O) |) k6 y# pcs cluster enable --all  O# N5 m- r4 g! C
controller1: Cluster Enabled6 U- ]5 o, U) h: m- L
controller2: Cluster Enabled
8 A; N9 [" p" Q! r" ], @controller3: Cluster Enabled+ ?  @! R. M0 C4 m

; v$ W% x! q5 e# pcs cluster disable --all
# u$ W$ B* s. ]% Kcontroller1: Cluster Disabled$ a' M8 s- a# a2 x  d* Y
controller2: Cluster Disabled
2 `1 o! S( {: n! A7 A* Q( X  tcontroller3: Cluster Disabled
% [! j- q& j# _1 P1 h
6 j0 X" |3 A7 ?; _3 y8 C# [. W

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 apache' T; B) P+ y0 B/ H8 ^' \5 M
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.
9 I# x0 {6 t& M: S) ^6 V( X
. f% k( W: `0 w  H) n# pcs resource create httpd_vip IPaddr2 ip=192.168.12.100 cidr_netmask=24 --group apache
9 e% W! k6 B3 v9 r# A" vCreate an Apache resource which will monitor the status of Apache server and move the resource to another node in case of any failure.7 j/ b9 ]: E, d( B) E' ?% Y

4 U5 u+ z- ^% b2 N4 d# pcs resource create httpd_ser apache configfile="/etc/httpd/conf/httpd.conf" statusurl="http://127.0.0.1/server-status" --group apache
6 {/ T5 J# s2 l* o4 X$ E4 |; K; ZSince 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.
, p+ K3 X+ U9 I7 _+ H$ ?% w
/ A" Q& R  w' E! {; m# pcs property set stonith-enabled=false, b9 m% n7 K8 c& r; P2 O
Check the status of the cluster.' ~# Q0 E1 b) Y' o7 f

0 e* E7 `+ @3 B[root@node1 ~]# pcs status
6 D3 i  `% X3 ~3 F) S. mCluster name: itzgeek_cluster
+ }+ Q& v2 M$ W) Y: ^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. G- x( Y* R4 X3 p% E
Stack: corosync
9 x/ Z& K$ i' z# ACurrent DC: node2.itzgeek.local (version 1.1.13-10.el7_2.2-44eb2dd) - partition with quorum/ `2 P4 B) b5 c! z4 ~) ]
2 nodes and 3 resources configured
5 ]3 V2 v5 w3 M& O. E( A) h& h4 ~/ H0 p. |4 S/ `& ~
Online: [ node1.itzgeek.local node2.itzgeek.local ]1 A2 i' ?! [5 O- D4 O. s; \6 }
5 c# ]2 S+ E& S$ R6 Y0 |: G
Full list of resources:$ i: F' [: D( U2 O9 p, z

* x% |  w2 g2 j" ?6 T5 Q) _ Resource Group: apache
: g/ X  @6 o* K* @& i8 d     httpd_vip  (ocf::heartbeat:IPaddr2):       Started node1.itzgeek.local" z, s& I; s" P9 J: z! K: K$ u
     httpd_ser  (ocf::heartbeat:apache):        Started node1.itzgeek.local
$ n& v, d9 d( s: J     httpd_fs   (ocf::heartbeat:Filesystem):    Started node1.itzgeek.local! v, r1 [  f7 U% A

1 V: ?" Y1 K  P( Q) oPCSD Status:
# z4 l' r0 Q' f+ L% T  node1.itzgeek.local: Online
. z5 v# J' M$ M5 H5 y4 B4 z* ~. W  node2.itzgeek.local: Online- s3 _0 y5 Q! k5 ?' w, O& K

! D9 H7 X5 Y' p& {7 V7 ~2 ZDaemon Status:
3 ^  c, e( K  z- V, k9 t  corosync: active/enabled
* T! N1 s5 G7 B! D  pacemaker: active/enabled% [0 Z1 ~' z) w% d1 I
  pcsd: active/enabled

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2017-12-29 12:47:47 | 显示全部楼层
[root@node1 ~]# pcs cluster stop node1.itzgeek.local
2 h+ B% e  k! k2 }+ E#  pcs resource move apache node1.itzgeek.local
% u9 D* {* O1 J$ o2 i8 O( S#  pcs resource stop apache node2.itzgeek.local2 Z  ~2 I, G1 ^+ _
#  pcs resource disable apache node2.itzgeek.local
$ P) `$ c/ v( D. b#  pcs resource enable apache node2.itzgeek.local
8 q8 i5 y; Y- l( I#  pcs resource restart apache

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2018-1-12 22:50:59 | 显示全部楼层
pcs status corosync
# y2 y+ a, A: q2 J
# S' k7 ?9 o' j+ ~, c3 Z; z4 b4 hMembership information5 F* S1 k8 z/ f& }9 ]
----------------------
! }* M' A: _5 K1 p  h    Nodeid      Votes Name3 _- }. s% {% p- h: e
         1          1 controller1 (local)
' q* w) A' X* L/ n( q. ?5 x         2          1 controller22 x9 v& {' A5 ]5 N3 D9 v& `$ t6 p
         3          1 controller3
. w  H2 n7 U- \; E. p7 B) w3 f; t2 _% ?6 L2 F, y% l9 }2 f( Z
pcs cluster cib4 x0 e- `, e' I: E$ d; V/ g  w# n3 g

' P  D. T4 `( W1 ~! Z) y  a' opcs property set stonith-enabled=true
6 Z) C; _; V; _& F) k  d8 n+ u2 R" n. O$ g: Y
pcs property$ g! s0 U2 _6 [- t- S3 D4 f1 d
Cluster Properties:8 o, a6 T. O5 B, X3 E5 I+ b' C
cluster-infrastructure: corosync+ E6 ~4 Q. J+ `* [1 \' P' Y
cluster-name: my_wsrep_cluster" y* G( n  w1 z. i3 d
dc-version: 1.1.16-12.el7_4.5-94ff4df6 g2 u. Z. l) v
have-watchdog: false
$ k( Y- @* p2 P6 C3 y no-quorum-policy: ignore, \# c- r+ g( r
stonith-enabled: true# m9 o$ F+ D1 w! s

3 r2 y# x7 U& K
9 W9 U( R2 U/ V2 H. `  H

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2018-1-12 23:02:16 | 显示全部楼层
    pcs resource show+ `$ S7 ?6 \" Z8 m
      Show all resources.4 a" [: [( v6 J1 D8 T% b/ {
2 J9 K9 b* i, `% `/ m9 S
    pcs resource show VirtualIP; c. x) \2 c& X- B% ]
      Show options specific to the 'VirtualIP' resource.0 r# H4 P! A, D, u5 P" @6 E

# J* c: R9 o- F7 `5 i4 X1 r% x  C! Z8 @
    pcs resource create VirtualIP ocf:heartbeat:IPaddr2 ip=192.168.0.99 \
4 \/ _$ C/ T+ K+ O1 ]: A3 n6 J& W6 s               cidr_netmask=32 nic=eth2 op monitor interval=30s8 P: h! T% H& d8 s% ?5 C( W- T
      Create a new resource called 'VirtualIP' with options.: x( y5 x8 A, W' y
5 R( k, N3 P2 r) u4 L" w. @
    pcs resource create VirtualIP IPaddr2 ip=192.168.0.99 \
# W  |. V1 @/ B+ h  `% m- ?               cidr_netmask=32 nic=eth2 op monitor interval=30s
3 x  `' D3 {  J+ _      Create a new resource called 'VirtualIP' with options.
) L$ l- |' E4 C1 `1 ]
2 k8 m) _/ j( \9 x% `    pcs resource update VirtualIP ip=192.168.0.98 nic=
1 B: q7 X; x+ U! [* T9 B      Change the ip address of VirtualIP and remove the nic option.
- y- H  I6 i' m4 i8 A! D
9 e. R, M+ D8 h    pcs resource delete VirtualIP
4 Z/ e" s; U! O# S, u! z7 h      Delete the VirtualIP resource.

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2018-1-13 00:23:26 | 显示全部楼层
集群故障时候服务迁移
+ k% l2 I6 t1 X# d' @7 r* r0 P$ b) S8 e7 q  m% F
5 c0 I7 u- r, r5 e9 f# ]

' O" O1 n% A/ j( ], `* A# pcs resource defaults migration-threshold=1
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

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

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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