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