請參照之前 Centos 6.4 ==> Corosync+Pacemaker+DRBD+MySQL HA 的設定
http://echochio.pixnet.net/blog/post/39271813
http://echochio.pixnet.net/blog/post/39359716
http://echochio.pixnet.net/blog/post/39286105
接下來加入 apache+php
-------------------------------------------------------------------------------
yum install -y php httpd
ssh node2 "yum install -y php httpd"
[root@node1 www]# crm_mon -1 |grep Masters
Masters: [ node1 ]
[root@node1 ~]# mkdir /mydata/web/
[root@node1 ~]#cd /var/www
[root@node1 www]## tar cvf - . |(cd /mydata/web/;tar xvf -)
[root@node1 www]# cd /var
[root@node1 var]# rm -rf www
[root@node1 var]# ln -s /mydata/web www
[root@node1 ~]# cat /mydata/web/html/index.php
<HTML>
HA Apache - <?php echo gethostname(); ?>
</HTML>
切換至 node2 建立 soft link
[root@node1 ~]# crm node standy node1
[root@node1 ~]# rm -rf /var/www
[root@node1 ~]# ln -s /mydata/web /var/www
[root@node1 ~]# crm node online node1
兩台 /etc/httpd/conf/httpd.conf (讓 127.0.0.1 可存取)
<location server-status="">
SetHandler server-status
Order deny,allow
Deny from all
Allow from 127.0.0.1
</location>
------------------------------------------------------------------------------
開VIP網頁 http:// ....../index.php
------------------------------------------------------------------------------
node node1 \
attributes standby="off"
node node2 \
attributes standby="off"
primitive WebSite lsb:httpd
primitive drbd_mysql ocf:linbit:drbd \
params drbd_resource="web" \
op monitor interval="15s"
primitive fs_mysql ocf:heartbeat:Filesystem \
params device="/dev/drbd0" directory="/mydata" fstype="ext3"
primitive ip_mysql ocf:heartbeat:IPaddr2 \
params ip="10.10.20.9" nic="bond0:0"
primitive mysqld lsb:mysqld
primitive ping_intgw ocf:pacemaker:ping \
params host_list="10.10.20.254" multiplier="1000" dampen="5" \
op monitor interval="1s"
group mysql fs_mysql ip_mysql mysqld WebSite
ms ms_drbd_mysql drbd_mysql \
meta master-max="1" master-node-max="1" clone-max="2" clone-node-max="1" notify="true"
clone ping_intgw_clone ping_intgw \
meta globally-unique="false"
location mysql_on_connected_node mysql \
rule $id="mysql_on_connected_node-rule" -inf: not_defined pingd or pingd lte 0
colocation mysql_on_drbd inf: mysql ms_drbd_mysql:Master
order mysql_after_drbd inf: ms_drbd_mysql:promote mysql:start
property $id="cib-bootstrap-options" \
dc-version="1.1.10-1.el6_4.4-368c726" \
cluster-infrastructure="classic openais (with plugin)" \
expected-quorum-votes="2" \
stonith-enabled="false" \
no-quorum-policy="ignore" \
last-lrm-refresh="1385599006"
rsc_defaults $id="rsc-options" \
resource-stickiness="100"
留言列表