error: unpack_resources: Resource start-up disabled since no STONITH resources have been defined
error: unpack_resources: Either configure some or disable STONITH with the stonith-enabled option
error: unpack_resources: NOTE: Clusters with shared data need STONITH to ensure data integrity
Errors found during check: config not valid
-V may provide more details
######禁用Stonith并查看
[root@nod1 ~]# crm configure property stonith-enabled=false
[root@nod1 ~]# crm configure show
node nod1.allen.com
node nod2.allen.com
property $id="cib-bootstrap-options" \
dc-version="1.1.8-7.el6-394e906" \
cluster-infrastructure="classic openais (with plugin)" \
expected-quorum-votes="2" \
stonith-enabled="false"
2、查看当前的集群系统支持的类型
[root@nod1 ~]# crm ra classes
lsb
ocf / heartbeat linbit pacemaker RedHat
service
stonith
注释:linbit 资源类型只有安装DRBD服务才会有
3、如何查看某种类型下所用可用的资源代理列表?
crm ra list lsb
crm ra list ocf heartbeat
crm ra list ocf pacemaker
crm ra list stonith
crm ra list ocf linbit
4、配置VIP资源与Mysqld资源
[root@nod1 ~]# crm #进入crm交互模式
crm(live)# configure
crm(live)configure# property no-quorum-policy="ignore"
crm(live)configure#primitive WebIP IPaddr params ip=172.18.109.238 nic="eth0:0" cidr_netmask=26
crm(live)configure#primitive myserver lsb:mysql op monitor interval=60 timeout=60 on-fail=restart
crm(live)configure# verify #检查语法错误
crm(live)configure# commit #提交
crm(live)configure# show #查看配置
5、配置DRBD主从资源
crm(live)configure#primitive mysqldrbd ocf:linbit:drbd params drbd_resource="mysql" op monitor interval="30s" role="Master" timeout="30s" op monitor interval="40s" role="Slave" timeout="30s" op start interval="0" timeout="240" op stop interval="0" timeout="100"
crm(live)configure#ms ms_mysqldrbd mysqldrbd meta master-max="1" master-node-max="1" clone-max="2" clone-node-max="1" notify="true"
6、定义一个文件系统资源
crm(live)configure#primitive mysqlfs ocf:heartbeat:Filesystem params device="/dev/drbd0" directory="/data/mysql" fstype="ext4" op start timeout="60s" op stop timeout="60s"
7、配置资源组合资源约束
目的是为让mysql和drbd资源在同一个节点,而且drbd必须先于mysql启动。
crm(live)configure#group lnmp WebIP webnfs mysqlfs myserver WebSite #这里新增加了web和webnfs资源,目的是为创建高可用的lnmp,如果不需要去掉web和webnfs即可。注意资源顺序。
crm(live)configure# colocation lnmp_with_ms_mysqldrbd inf: lnmp ms_mysqldrbd:Master #mysql和drbd资源在同一个节点
crm(live)configure#order lnmp_after_ms_mysqldrbd inf: ms_mysqldrbd:promote lnmp:start #drbd先于lnmp启动
8、查看服务状态如下:
[root@nod1 ~]# crm status
Master/Slave Set: ms_mysqldrbd [mysqldrbd]
Masters: [ node2.test.com ]
Slaves: [ node1.test.com ]
Resource Group: lnmp
WebIP (ocf::heartbeat:IPaddr): Started node2.test.com
webnfs (ocf::heartbeat:Filesystem): Started node2.test.com
mysqlfs (ocf::heartbeat:Filesystem): Started node2.test.com
myserver (lsb:mysql): Started node2.test.com
(责任编辑:liangzh) |