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

成功!

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

桂安俊@kylinOS

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值