一、网络文件系统(Network File System)介绍
它是当前主流异构平台共享文件系统之一,允许一个系统在网络上与他人共享目录和文件。通过使用NFS,用户和程序可以像访问本地文件一样访问远端系统上的文件,使得每个计算机的节点能够像使用本地资源一样方便地使用网上资源。
特点:
1.提供透明文件访问以及文件传输
2.容易扩充新的资源或软件,不需要改变现有的工作环境
3.高性能,可灵活配置
工作原理:
使用客户端/服务器架构,由一个客户端程序和服务器程序组成。服务端程序向客户端输出共享文件,客户端程序从服务端拉取数据。通常以块为单位,其大小为8KB。
二、实验
yum -y install rpcbind nfs-utils
systemctl start rpcbind
systemctl enable prcbind
systemctl start nfs
systemctl enable nfs
创建共享目录
mkdir -p /opt/share
vi /etc/exports
/opt/share 本地ip地址/子网掩码(rw,sync,no_root_squash)
systemctl start rpcbind
systemctl start nfs
查看是否已经开启
yum -y install net-tools //这里因为我是最小化安装,所以需要安装
netstat -anpt | grep rpc
查看共享目录
showmount -e