ApacheHAソスNソスソスソスXソス^ソスソス(Pacemaker+Corosync+pcs+Apache)

ソスナ終ソスXソスVソスソスソスF 2018.02.21

ソスソスソスTソスv

ApacheソスソスソスNソスソスソスXソス^ソスソスソスソスソスト、ソスソスソスpソスTソス[ソスoソス[ソスソスソスソスソス_ソスEソスソスソスソスソストゑソスソスメ機ソスTソス[ソスoソス[ソスソスソスナサソス[ソスrソスXソスソスソスpソスソスソスナゑソスソスソス謔、ソスノゑソスソスソスB

ソスソスHAソスNソスソスソスXソス^ソス[ソスVソスXソスeソスソスソス\ソスzソスソスソスAソスfソスBソスXソスNHAソスNソスソスソスXソス^ソスソスソスソスソスナゑソスソス驍アソスソス


ソスyソスOソスソスソスソスソスソスz
ソスTソス[ソスoソス[1 192.168.1.15 node1
ソスTソス[ソスoソス[2 192.168.1.16 node2
ソスソスソスzIPソスAソスhソスソスソスX 192.168.1.17


ソスソスApacheソスCソスソスソスXソスgソス[ソスソス

ApacheソスCソスソスソスXソスgソス[ソスソス

ソスソスApacheソスン抵ソス

[root@node1 ~]# vi /etc/httpd/conf.d/status.confソス@ソスソスソス@ApacheソスTソス[ソスoソス[ソスソスソスvソスソスソスン抵ソスtソス@ソスCソスソスソス成
ExtendedStatus On

<Location /server-status>
    SetHandler server-status
    Require local
</Location>


[root@node1 ~]# systemctl reload httpdソス@ソスソスソス@Apacheソスン定反ソスf

[root@node1 ~]# wget -q -S http://127.0.0.1/server-statusソス@ソスソスソス@ApacheソスTソス[ソスoソス[ソスソスソスvソスソスソスmソスF
  HTTP/1.1 200 OKソス@ソスソスソス@200ソスナゑソスソス驍アソスソス
  Date: Wed, 20 Dec 2017 08:35:08 GMT
  Server: Apache/2.4.6 (CentOS) PHP/5.4.16
  Content-Length: 3848
  Keep-Alive: timeout=5, max=100
  Connection: Keep-Alive
  Content-Type: text/html; charset=ISO-8859-1

[root@node1 ~]# systemctl stop httpdソス@ソスソスソス@Apacheソスソス~

[root@node1 ~]# systemctl disable httpdソス@ソスソスソス@ApacheソスソスソスソスソスNソスソスソスン抵ソスソスソスソス
ソスソスソスソスソスソスソスワでゑソスnode2ソスソスソスナゑソスソスソスソス{


ソスソスApacheソスNソスソスソスXソス^ソスソス

[root@node1 ~]# pcs resource update FS_DRBD0 directory=/var/www/htmlソス@ソスソスソス@DRBDソスfソスBソスXソスNソス}ソスEソスソスソスgソスソスfソスBソスソスソスNソスgソスソスソスソスApacheソスフドソスLソスソスソスソスソスソスソスgソスソスソス[ソスg(ソスソス:/var/www/html)ソスノ変更

[root@node1 ~]# pcs resource create HTTPD ocf:heartbeat:apache configfile="/etc/httpd/conf/httpd.conf" statusurl="http://127.0.0.1/server-status" --group apachegroupソス@ソスソスソス@ApacheソスソスHTTPDソスニゑソスソスソスソスソスソスOソスナクソスソスソスXソス^ソスソスソス\ソス[ソスXソスノ追会ソス

[root@node1 ~]# pcs resource cleanupソス@ソスソスソス@ソスソスソス\ソス[ソスXソスNソスソスソス[ソスソスソスAソスbソスv

[root@node1 ~]# pcs resource showソス@ソスソスソス@ソスソスソス\ソス[ソスXソスmソスF
 Resource Group: apachegroup
     vipcheck_res       (ocf::myres:VIPcheck):  Started node1
     VirtualIP  (ocf::heartbeat:IPaddr2):       Started node1
     FS_DRBD0   (ocf::heartbeat:Filesystem):    Started node1
     HTTPD      (ocf::heartbeat:apache):        Started node1ソス@ソスソスソス@HTTPD
 Master/Slave Set: MS_DRBD0 [DRBD0]
     Masters: [ node1 ]
     Slaves: [ node2 ]

ソスソスApacheソスNソスソスソスXソス^ソスソスソスmソスF

ソスiソスPソスjソスNソスソスソスXソス^ソスmソスF
[root@node1 ~]# echo test > /var/www/html/index.htmlソス@ソスソスソス@ソスeソスXソスgHTMLソス成

ソスソスhttp://192.168.1.17/ソスノアソスNソスZソスXソスソスソスソスtestソスニ表ソスソスソスソスソスソス驍アソスソス

ソスiソスQソスjソスtソスFソスCソスソスソスIソス[ソスoソス[
[root@node1 ~]# haltソス@ソスソスソス@node1(ソスソスソスpソスソス)ソスVソスXソスeソスソスソスソス~

[root@node2 ~]# pcs statusソス@ソスソスソス@node2ソスソスソスナクソスソスソスXソス^ソスソスヤ確ソスF
Cluster name: mycluster
Stack: corosync
Current DC: node2 (version 1.1.16-12.el7_4.5-94ff4df) - partition with quorum
Last updated: Thu Dec 21 13:54:23 2017
Last change: Thu Dec 21 13:54:02 2017 by root via cibadmin on node2

2 nodes configured
6 resources configured

Online: [ node2 ]
OFFLINE: [ node1 ]ソス@ソスソスソス@node1ソスソスソスIソスtソスソスソスCソスソスソスソスヤになゑソスソスソス

Full list of resources:

 Resource Group: apachegroup
     vipcheck_res       (ocf::myres:VIPcheck):  Started node2ソス@ソスソスソス@ソスソスソス\ソス[ソスXソスソスnode2ソスソスソスノ移難ソスソスソスソスソス
     VirtualIP  (ocf::heartbeat:IPaddr2):       Started node2ソス@ソスソスソス@ソスソスソス\ソス[ソスXソスソスnode2ソスソスソスノ移難ソスソスソスソスソス
     FS_DRBD0   (ocf::heartbeat:Filesystem):    Started node2ソス@ソスソスソス@ソスソスソス\ソス[ソスXソスソスnode2ソスソスソスノ移難ソスソスソスソスソス
     HTTPD      (ocf::heartbeat:apache):        Started node2ソス@ソスソスソス@ソスソスソス\ソス[ソスXソスソスnode2ソスソスソスノ移難ソスソスソスソスソス
 Master/Slave Set: MS_DRBD0 [DRBD0]
     Masters: [ node2 ]ソス@ソスソスソス@DRBDソスソスmasterソスソスnode2ソスソスソスノ切ゑソスヨゑソスソスソスソス
     Stopped: [ node1 ]

Daemon Status:
  corosync: active/enabled
  pacemaker: active/enabled
  pcsd: active/enabled

ソスソスhttp://192.168.1.17/ソスノアソスNソスZソスXソスソスソスソスtestソスニ表ソスソスソスソスソスソス驍アソスソス

ソスiソスRソスjソスtソスFソスCソスソスソスoソスbソスN
node1ソスNソスソス

[root@node1 ~]# pcs statusソス@ソスソスソス@ソスNソスソスソスXソス^ソスソスヤ確ソスF
Cluster name: mycluster
Stack: corosync
Current DC: node2 (version 1.1.16-12.el7_4.5-94ff4df) - partition with quorum
Last updated: Thu Dec 21 13:56:31 2017
Last change: Thu Dec 21 13:54:02 2017 by root via cibadmin on node2

2 nodes configured
6 resources configured

Online: [ node1 node2 ]ソス@ソスソスソス@node1ソスソスソスIソスソスソスソスソスCソスソスソスソスヤになゑソスソスソス

Full list of resources:

 Resource Group: apachegroup
     vipcheck_res       (ocf::myres:VIPcheck):  Started node2ソス@ソスソスソス@ソスソスソス\ソス[ソスXソスソスnode2ソスソスソスフまゑソス
     VirtualIP  (ocf::heartbeat:IPaddr2):       Started node2ソス@ソスソスソス@ソスソスソス\ソス[ソスXソスソスnode2ソスソスソスフまゑソス
     FS_DRBD0   (ocf::heartbeat:Filesystem):    Started node2ソス@ソスソスソス@ソスソスソス\ソス[ソスXソスソスnode2ソスソスソスフまゑソス
     HTTPD      (ocf::heartbeat:apache):        Started node2ソス@ソスソスソス@ソスソスソス\ソス[ソスXソスソスnode2ソスソスソスフまゑソス
 Master/Slave Set: MS_DRBD0 [DRBD0]
     Masters: [ node2 ]ソス@ソスソスソス@DRBDソスソスmasterソスソスnode2ソスソスソスフまゑソス
     Slaves: [ node1 ]

Daemon Status:
  corosync: active/enabled
  pacemaker: active/enabled
  pcsd: active/enabled

[root@node1 ~]# pcs cluster standby node2ソス@ソスソスソス@node2ソスソスソスソスソスXソス^ソスソスソスoソスCソスソスヤへ切托ソス

[root@node1 ~]# pcs statusソス@ソスソスソス@ソスNソスソスソスXソス^ソスソスヤ確ソスF
Cluster name: mycluster
Stack: corosync
Current DC: node2 (version 1.1.16-12.el7_4.5-94ff4df) - partition with quorum
Last updated: Thu Dec 21 13:57:12 2017
Last change: Thu Dec 21 13:56:56 2017 by root via cibadmin on node1

2 nodes configured
6 resources configured

Node node2: standbyソス@ソスソスソス@node2ソスソスソスXソス^ソスソスソスoソスCソスソスヤになゑソスソスソス
Online: [ node1 ]

Full list of resources:

 Resource Group: apachegroup
     vipcheck_res       (ocf::myres:VIPcheck):  Started node1ソス@ソスソスソス@ソスソスソス\ソス[ソスXソスソスnode1ソスソスソスノ移難ソスソスソスソスソス
     VirtualIP  (ocf::heartbeat:IPaddr2):       Started node1ソス@ソスソスソス@ソスソスソス\ソス[ソスXソスソスnode1ソスソスソスノ移難ソスソスソスソスソス
     FS_DRBD0   (ocf::heartbeat:Filesystem):    Started node1ソス@ソスソスソス@ソスソスソス\ソス[ソスXソスソスnode1ソスソスソスノ移難ソスソスソスソスソス
     HTTPD      (ocf::heartbeat:apache):        Started node1ソス@ソスソスソス@ソスソスソス\ソス[ソスXソスソスnode1ソスソスソスノ移難ソスソスソスソスソス
 Master/Slave Set: MS_DRBD0 [DRBD0]
     Masters: [ node1 ]ソス@ソスソスソス@DRBDソスソスmasterソスソスnode1ソスソスソスノ切ゑソスヨゑソスソスソスソス
     Stopped: [ node2 ]

Daemon Status:
  corosync: active/enabled
  pacemaker: active/enabled
  pcsd: active/enabled

[root@node1 ~]# pcs cluster unstandby node2ソス@ソスソスソス@node2ソスソスソスフスソス^ソスソスソスoソスCソスソスヤゑソスソスソスソスソス

[root@node1 ~]# pcs statusソス@ソスソスソス@ソスNソスソスソスXソス^ソスソスヤ確ソスF
Cluster name: mycluster
Stack: corosync
Current DC: node2 (version 1.1.16-12.el7_4.5-94ff4df) - partition with quorum
Last updated: Thu Dec 21 13:58:06 2017
Last change: Thu Dec 21 13:57:37 2017 by root via cibadmin on node1

2 nodes configured
6 resources configured

Online: [ node1 node2 ]ソス@ソスソスソス@node2ソスソスソスIソスソスソスソスソスCソスソスソスソスヤになゑソスソスソス

Full list of resources:

 Resource Group: apachegroup
     vipcheck_res       (ocf::myres:VIPcheck):  Started node1ソス@ソスソスソス@ソスソスソス\ソス[ソスXソスソスnode1ソスソスソスフまゑソス
     VirtualIP  (ocf::heartbeat:IPaddr2):       Started node1ソス@ソスソスソス@ソスソスソス\ソス[ソスXソスソスnode1ソスソスソスフまゑソス
     FS_DRBD0   (ocf::heartbeat:Filesystem):    Started node1ソス@ソスソスソス@ソスソスソス\ソス[ソスXソスソスnode1ソスソスソスフまゑソス
     HTTPD      (ocf::heartbeat:apache):        Started node1ソス@ソスソスソス@ソスソスソス\ソス[ソスXソスソスnode1ソスソスソスフまゑソス
 Master/Slave Set: MS_DRBD0 [DRBD0]
     Masters: [ node1 ]ソス@ソスソスソス@DRBDソスソスmasterソスソスnode1ソスソスソスフまゑソス
     Slaves: [ node2 ]

Daemon Status:
  corosync: active/enabled
  pacemaker: active/enabled
  pcsd: active/enabled

ソスソスhttp://192.168.1.17/ソスノアソスNソスZソスXソスソスソスソスtestソスニ表ソスソスソスソスソスソス驍アソスソス


ソスソスソスヨ連ソスRソスソスソスeソスソスソスc

<!ソス\ソスeソスLソスXソスgソスフみゑソス4ソスsソス\ソスソスソスノ追会ソスソスソスCソスソスソスソスソスソス\>



ソスソスソスソスソスフペソス[ソスWソスフトソスbソスvソスヨ戻ゑソス

ソスvソスソスソスCソスoソスVソス[ソス|ソスソスソスVソス[
centossrv.com