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

pacemaker中pcs命令的介绍

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2017-12-29 10:50:47 | 显示全部楼层 |阅读模式
pcs cluster destroy --all       删除集群
9 |: Y; t8 j7 Z6 Y' tWarning: Unable to load CIB to get guest and remote nodes from it, those nodes will not be deconfigured.
) F+ \, m* E; G4 f8 hcontroller3: Stopping Cluster (pacemaker)...
  `  R  S, W$ q1 a; Q% Hcontroller1: Stopping Cluster (pacemaker)...% k! c2 ^$ Z3 ?: f$ y; S# T/ f; f, Y# e
controller2: Stopping Cluster (pacemaker)...
- {  }3 d6 l* y, `controller2: Successfully destroyed cluster
: g: B/ W, w) O) e5 B  qcontroller3: Successfully destroyed cluster
8 s; ]$ F5 u% Mcontroller1: Successfully destroyed cluster
/ `+ n4 U4 P7 s4 U, U
9 T* c  T, d3 S" |1 l: Q5 j
% p/ T2 {  ?  m" ]1 w+ y4 i$ p5 dpcs cluster stop --all   停止所有集群
% p! [# N) H% E; p4 B) |
0 y. @6 Q" @0 y: d7 k! W$ R* Q
1 f1 t1 K9 l( y% T% S& O: R# pcs cluster enable --all
3 O5 v! @/ Q% [controller1: Cluster Enabled
' h& u5 y, F; H' |) Y: ]5 Econtroller2: Cluster Enabled
9 H; M, e5 z) `/ l; T' c3 g4 Mcontroller3: Cluster Enabled) a1 a6 n' p5 E* c0 {# f3 [
& K" w9 e- T5 d3 b
# pcs cluster disable --all2 `% F. `0 D; u4 A9 A
controller1: Cluster Disabled
8 V+ R8 ]0 E: G* z& Lcontroller2: Cluster Disabled
8 B0 w/ B4 z5 t( H5 Z! Scontroller3: Cluster Disabled2 |  o$ |3 N+ j; Z/ i

- e$ m) N( k. C) ]9 z! r6 m( G

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
7 `# H# o8 l4 e3 |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.
. H8 e3 h/ f' f9 Z& d/ V9 p3 P6 \, |* J4 A4 L- f# p
# pcs resource create httpd_vip IPaddr2 ip=192.168.12.100 cidr_netmask=24 --group apache
3 d3 q1 M% C" U& e% \Create an Apache resource which will monitor the status of Apache server and move the resource to another node in case of any failure.
# p: h7 f0 w3 y. w6 G5 k
( B) {$ ^6 X7 V1 `7 a" B1 g# pcs resource create httpd_ser apache configfile="/etc/httpd/conf/httpd.conf" statusurl="http://127.0.0.1/server-status" --group apache3 _6 i% D4 {7 k+ I7 w) H8 w) A7 j6 @
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.  b. n, e: p6 n

/ x" w5 S4 E/ G# F# pcs property set stonith-enabled=false/ L" r" ]' S9 m* ^
Check the status of the cluster.8 S  S# `' B* w2 Y$ L  V
' c$ P3 N/ Q% F; m' o4 K) H
[root@node1 ~]# pcs status
  g& u, T' N* x* M( R) T( i1 FCluster name: itzgeek_cluster6 m6 f# E; W" v! U' R$ I& N& P
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
6 e# m0 [4 R1 s# V) ^0 ?" @Stack: corosync
+ H; D; T5 F0 d* E$ I& zCurrent DC: node2.itzgeek.local (version 1.1.13-10.el7_2.2-44eb2dd) - partition with quorum6 E+ A( J! I! r; N+ g& v( W1 m: L- ?8 A
2 nodes and 3 resources configured
3 X: e0 _$ l, r) h( S/ e! {
: P( V( N7 i7 c9 @; [8 WOnline: [ node1.itzgeek.local node2.itzgeek.local ]
/ e$ e$ d: Q" c6 y
% `! l7 Q6 F( I& v6 X: N2 Z, ]% B+ JFull list of resources:4 w8 ^$ R/ G6 r

% W, f& D: ]2 L+ R3 ^$ w) H Resource Group: apache
& w; a& q2 {) P9 e3 }     httpd_vip  (ocf::heartbeat:IPaddr2):       Started node1.itzgeek.local
, f# J2 c; V9 d4 j. b     httpd_ser  (ocf::heartbeat:apache):        Started node1.itzgeek.local
5 U5 L% y7 Y& F4 M  n) e; \     httpd_fs   (ocf::heartbeat:Filesystem):    Started node1.itzgeek.local
4 f: r8 x# h: K6 K# T/ b3 k/ h, G9 B+ }; F, J+ G4 d7 g! }4 I% u* L8 m
PCSD Status:
* Q; J8 m. t1 R. g- w4 Z  node1.itzgeek.local: Online, K) z, a) c0 c" G  x* k& [
  node2.itzgeek.local: Online, R0 p+ D. q; ^
- ^+ J& }. v  h+ V3 a' P$ m! B. @
Daemon Status:
; {% G1 p+ d3 q+ t( {4 {  corosync: active/enabled) Y/ J6 j3 \2 |& F5 a3 {" M" s* v
  pacemaker: active/enabled5 g% l8 c$ I+ W. `' y) l3 P0 _6 Q
  pcsd: active/enabled

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2017-12-29 12:47:47 | 显示全部楼层
[root@node1 ~]# pcs cluster stop node1.itzgeek.local
' W9 m( d, o4 Y  J: I( t6 \$ w) K0 ]#  pcs resource move apache node1.itzgeek.local8 p. |3 V% ]" _/ p9 X& ~
#  pcs resource stop apache node2.itzgeek.local
# i2 t3 C5 i* j3 w9 B. l#  pcs resource disable apache node2.itzgeek.local
8 w& S5 i* n6 Q4 X, Z/ i8 t( q#  pcs resource enable apache node2.itzgeek.local( _. ?. [3 H" o! w
#  pcs resource restart apache

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2018-1-12 22:50:59 | 显示全部楼层
pcs status corosync5 \$ G; e$ v( h! r% C3 f

  N4 |9 z1 T+ G' mMembership information
% T2 F  w- v  A" J3 {$ }----------------------
) u7 [, b) K; B8 q% {5 C    Nodeid      Votes Name
6 m: P6 F$ Y& h: e  U" J         1          1 controller1 (local)
+ Q& s6 V. W7 X         2          1 controller2+ X7 N# `2 A9 P0 S" u
         3          1 controller3
# s( J8 G) q3 x' B0 s0 K% F; M* g; D0 z' P0 S" T, k9 U) L/ j: Z
pcs cluster cib
" H% }3 s# i" b/ b3 b
6 M  Y5 k# ^% lpcs property set stonith-enabled=true
) s' W. A) B) _6 h7 n
, }  s( H1 Z2 j+ R8 z% y. Hpcs property
2 i" {0 n  T+ H* F4 R8 B  sCluster Properties:
8 l/ t# S9 r# { cluster-infrastructure: corosync, f7 g: p: ^! c9 Q1 f$ P
cluster-name: my_wsrep_cluster. ?& z# x3 N  `
dc-version: 1.1.16-12.el7_4.5-94ff4df
; e1 ~; U$ k: ~5 b/ b& @. G; ^/ I have-watchdog: false
; A  A6 K- y' B2 L  l" v5 W no-quorum-policy: ignore
7 Y9 Z% P" ~( Q6 g& \  S  S stonith-enabled: true( Q( g9 i% v" Z% {6 N4 Q
: M9 H# P5 f8 }0 w1 h
" ~, z* y: p6 @7 W

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2018-1-12 23:02:16 | 显示全部楼层
    pcs resource show; n. h1 N+ V" J& F3 |
      Show all resources.! `  d1 c& j- S) n  _  Z
# @4 l# e0 E9 A6 b: C
    pcs resource show VirtualIP
7 {* M8 y% u1 F+ Z( _( [  b- L+ R      Show options specific to the 'VirtualIP' resource.
) z; g; O2 {# P9 s$ h
1 ]+ X3 Q4 Z, Q
0 z% ?$ J+ S& k; V+ o    pcs resource create VirtualIP ocf:heartbeat:IPaddr2 ip=192.168.0.99 \
2 C( X! e' @' @               cidr_netmask=32 nic=eth2 op monitor interval=30s0 z6 B: u) l( q1 C
      Create a new resource called 'VirtualIP' with options.* f) t8 z0 c8 q

( H, L' z0 O( n7 {$ N( w8 V! x    pcs resource create VirtualIP IPaddr2 ip=192.168.0.99 \
$ t( L6 F$ i0 A, x8 c               cidr_netmask=32 nic=eth2 op monitor interval=30s
% s; @# Z9 C: M9 V$ {: O3 D% L' F      Create a new resource called 'VirtualIP' with options.9 _* H# r' h0 r' a% X2 X- k  d
! I* d3 d1 a6 ^7 ^( o4 M2 v
    pcs resource update VirtualIP ip=192.168.0.98 nic=% Z1 `* o/ T7 @, ~/ g# D
      Change the ip address of VirtualIP and remove the nic option.
2 C/ ]2 N2 v# C. R5 h( a+ e1 H7 Z0 r( K
    pcs resource delete VirtualIP$ [/ Q. I" L0 }2 b& H+ [
      Delete the VirtualIP resource.

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2018-1-13 00:23:26 | 显示全部楼层
集群故障时候服务迁移
2 M0 [) y9 v  }3 Q, |/ c4 |8 e# n5 ^0 t; B3 d1 \8 n) M. B+ U
3 |6 h6 w  H2 P3 e
" o' c( B& ^  s2 g; r
# pcs resource defaults migration-threshold=1
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

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

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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