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