网络文件系统,英文Network File System(NFS)
Storage服务端
开启nfs服务
yum install -y nfs-utils
yum install -y rpcbind
systemctl enable rpcbind
systemctl start rpcbind
systemctl enable nfs-server
systemctl start nfs-server
mkdir /nfsshare
#vi /etc/exports
echo "/nfsshare *.*(rw,sync)" > /etc/exports
exportfs -r
systemctl start rpcbind
systemctl start nfs-server
showmount -e 127.0.0.1
#本地测试是否能挂载成功,这样可以排查网络问题 yum install -y showmount
cd /nfsshare
echo hello > storage.txt
chmod o+rwx /nfsshare/
客户端:
yum install -y nfs-utils
#这个在客户端一定要安装,否则使用mount -t nfs挂载不起
showmount -e 10.1.1.4
mkdir /share
mount -t nfs 10.1.1.4:/nfsshare /share
df
cd /share
cat storage.txt
touch client.txt
echo hello > client.txt
cat client.txt
注释:默认情况下,客户端只能在该目录查看文件,不能写或者执行文件,如果想读写执行,那么需要在服务器端放开权限。