方式一:
直接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
成功!