NFS服务( 三 )

web1和web2[root@web01 ~]#yum install -y rpcbind nfs-utils[root@web01 ~]#yum install -y httpd php[root@web01 ~]#systemctl start httpd[root@web01 ~]#cd /var/www/html[root@web01 ~]# mount -t nfs 172.16.1.31:/sersync /var/www/html[root@web01 html]# rz -Erz waiting to receive.[root@web01 html]# unzip kaoshi.zip [root@web01 html]# systemctl restart httpd网站测试并访问[root@web01 ~]# vim ping.sh#!/bin/bashping -c1 172.16.1.31 >/dev/null if [ $? -ne 0 ];thenumount -lf /var/www/html && mount -t nfs 172.16.1.41:/backup /var/www/html/elsedf -h | grep 172.16.1.31 >/dev/nullif [ $? -ne 0 ];thenumount -lf /var/www/html && mount -t nfs 172.16.1.31:/sersync /var/www/htmlfifi[root@web01 ~]# chmod +x ping.sh [root@web01 ~]# crontab -e* * * * * /var/www/html/ping.shNFS小结
1.NFS存储优点
1)NFS文件系统简单易用、方便部署、数据可靠、服务稳定、满足中小企业需求 。
2)NFS文件系统内存放的数据都在文件系统之上,所有数据都是能看得见 。
2.NFS存储局限
1)存在单点故障, 如果构建高可用维护麻烦web -> nfs -> backup
2)NFS数据明文, 并不对数据做任何校验 。
3)客户端挂载NFS服务没有密码验证, 安全性一般(内网使用)
3.NFS应用建议
1)生产场景应将静态数据尽可能往前端推, 减少后端存储压力
2)必须将存储里的静态资源通过CDN缓存jpgpngmp4avicssjs
3)如果没有缓存或架构本身历史遗留问题太大, 在多存储也无用
摘录来源:givenchy_yzl博主




推荐阅读