1.添加共享存储资源
上一节已经讲了如何添加资源,这里练习一下如何添加共享存储资源,为httpd添加一个共享存储,使得资源切换的时候,用户看到的数据是一样的。
在node(物理机)上创建一个nfs共享存储
[root@server ~]#mkdir /web
[root@server ~]# chmod o+w /web
[root@server ~]# echo '/web *(rw,async)' > /etc/exports.d/aa.exports
[root@server ~]#systemctl start nfs-server
[root@server ~]#
在任一节点上测试nfs正常工作,并在共享存储里创建index.html
[root@nodeX ~]# showmount -e node
Export list for node:
/web *
[root@nodeX ~]# mount node:/web /mnt
[root@nodeX ~]# echo 'share storage node xxxxxxxx' > /mnt/index.html
[root@nodeX ~]# umount /mnt
下面添加资源
class/provider里选择ocf:heatbeat
Type里选择Filesystem
Resource Group里选择group_1
Resource ID里可以随便填写,这里填写nfs_web
device里填写nfs共享目录的路径,这里是node:/web
dirctory是在节点上的挂载点,因为默认httpd的文档目录是/var/www/html,所以这里填写/var/www/html
fstype填写nfs
点击"Create Resource"
因为涉及到资源约束条件(后面会讲),此处先把webserver所在组设置为none
点击"Apply Changes"
再次把webserver设置到group_1里:
点击"Apply Changes"
此时集群可以