|
|
楼主 |
发表于 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 |
|