nfs实现web后端集群存储

环境

RHEL6.5
nfs服务器server:192.168.169.133
web服务器client1:192.168.169.131;client2:192.168.169.134
nfs服务搭建见:https://blog.csdn.net/Ying_smile/article/details/80601519

在server端:
[root@server ~]# mkdir /share/web -p   #建立共享目录
[root@server ~]# echo "hello,i love you" > /share/web/index.html
[root@server ~]# vim /etc/exports 
/share/web 192.168.168.0/24(ro)
[root@server ~]# /etc/init.d/nfs restart   #重启服务
在client端:
1、安装httpd软件
[root@client1 ~]# rpm -q httpd   #查看已经安装
httpd-2.2.15-29.el6_4.x86_64
2、挂载nfs-server端的共享目录到/var/www/html
[root@client1 /]# ls /var/www/html/
[root@client1 /]# showmount -e 192.168.169.133   #查看共享文件
Export list for 192.168.169.133:
/share/web 192.168.169.0/24
[root@client1 /]# mount.nfs 192.168.169.133:/share/web /var/www/html
[root@client1 /]# ls /var/www/html/
index.html
3、启动服务
[root@client1 /]# service httpd start

测试验证:在浏览器测试,两台服务器都可以查看到共享文件的内容
在这里插入图片描述
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/Ying_smile/article/details/89304859