Pacemaker

node node-01 \
        attributes standby="off"
node node-02 \
        attributes standby="off"
        
## IP资源 
primitive ClusterIP ocf:heartbeat:IPaddr2 \
        params ip="192.168.99.191" cidr_netmask="24" \
        op monitor interval="30s"
## DRBD资源
primitive WebData ocf:linbit:drbd \
        params drbd_resource="wwwdata" \
        op monitor interval="60s"
## Mount DRBD块设备至/var/www/html
primitive WebFS ocf:heartbeat:Filesystem \
        params device="/dev/drbd/by-res/wwwdata" directory="/var/www/html" fstype="ext4"
## 应用启动
primitive WebSite ocf:heartbeat:apache \
        params configfile="/etc/httpd/conf/httpd.conf" \
        op monitor interval="1min" \
        meta target-role="Started"
ms WebDataClone WebData \
        meta master-max="1" master-node-max="1" clone-max="2" clone-node-max="1" notify="true"

#
location prefer-node-01 WebSite 50: node-01

## 确保资源在同一节点运行
colocation WebSite-with-WebFS inf: WebSite WebFS
colocation fs_on_drbd inf: WebFS WebDataClone:Master
colocation website-with-ip inf: WebSite ClusterIP

# 控制资源启动停止顺序
order WebFS-after-WebData inf: WebDataClone:promote WebFS:start
order WebSite-after-WebFS inf: WebFS WebSite
order apache-after-ip     inf: ClusterIP WebSite


property $id="cib-bootstrap-options" \
        dc-version="1.1.6-3.el6-a02c0f19a00c1eb2527ad38f146ebc0834814558" \
        cluster-infrastructure="openais" \
        expected-quorum-votes="2" \
        ## GCO
        stonith-enabled="false" \
        no-quorum-policy="ignore"
        
rsc_defaults $id="rsc-options" \
        resource-stickiness="100"

你可能感兴趣的:(Pacemaker)