suse12 企業版 pacemaker資源(drbd+pacemaker+corosync+mysql)配置

前提先執行下面操作:

#crm

crm(live/host1)# configure

crm(live/host1)configure# property stonith-enabled=false

crm(live/host1)configure# property no-quorum-policy=ignore

crm(live/host1)configure# verify      

crm(live/host1)configure# commit

然後下面開始配置HA資源:

方式一:

直接crm configure edit進入整體複製粘貼即可:

node host1 \
        attributes standby=on
node host2 \
        attributes standby=off
primitive data_drbd ocf:linbit:drbd \
        params drbd_resource=data \
        op monitor role=Master interval=10s timoue=20s \
        op monitor role=Slave interval=20s timeout=20s \
        op start interval=0 timeout=240 \
        op stop interval=0 timeout=120
primitive myip IPaddr \
        params ip=192.168.1.11
primitive mysql service:mysql
primitive mysqldatafs Filesystem \
        params device="/dev/drbd0" directory="/data" fstype=ext4 \
        op start interval=0 timeout=60 \
        op stop interval=0 timeout=60
ms MS_data_drbd data_drbd \
        meta master-max=1 master-node-max=1 clone-max=2 clone-node-max=1 notify=true
colocation myip_with_mysql inf: myip mysql
order mysql_after_mysqldatafs inf: mysqldatafs mysql
colocation mysql_with_mysqldatafs inf: mysql mysqldatafs
order mysqldatafs_afer_MS_data_drbd inf: MS_data_drbd:promote mysqldatafs:start
colocation mysqldatafs_with_MS_data_drbd inf: mysqldatafs MS_data_drbd:Master
property cib-bootstrap-options: \
        have-watchdog=false \
        dc-version="1.1.19+20180928.0d2680780-1.8-1.1.19+20180928.0d2680780" \
        cluster-infrastructure=corosync \
        cluster-name=cluster-database \
        stonith-enabled=false \
        no-quorum-policy=ignore

配置說明如下:

 

複製完保存退出查看集羣資源狀態,輸入命令crm status

成功!

 

方式二:

shell腳本執行

#!/bin/bash
crm configure property stonith-enabled=false
sleep 1
crm configure  property no-quorum-policy=ignore
sleep 1
crm configure primitive data_drbd ocf:linbit:drbd params drbd_resource=data op monitor role=Master interval=10s timoue=20s op monitor role=Slave interval=20s timeout=20s op start interval=0 timeout=240 op stop interval=0 timeout=120
sleep 1
crm configure ms MS_data_drbd data_drbd meta master-max=1 master-node-max=1 clone-max=2 clone-node-max=1 notify=true
sleep 1
crm configure primitive mysqldatafs Filesystem params device="/dev/drbd0" directory="/HA" fstype=ext4 op start interval=0 timeout=60 op stop interval=0 timeout=60
sleep 1
crm configure colocation mysqldatafs_with_MS_data_drbd inf: mysqldatafs MS_data_drbd:Master
sleep 1
crm configure order mysqldatafs_afer_MS_data_drbd inf: MS_data_drbd:promote mysqldatafs:start
sleep 1
crm configure primitive mysql service:mysql
sleep 1
crm configure colocation mysql_with_mysqldatafs inf: mysql mysqldatafs
sleep 1
crm configure order mysql_after_mysqldatafs inf: mysqldatafs mysql
sleep 1
crm configure primitive myip IPaddr params ip=192.168.1.23
sleep 1
crm configure colocation myip_with_mysql inf: myip mysql

執行完後重啓兩邊的pacemaker服務:

#service pacemaker restart

#crm status

成功!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章