服务端
yum -y install nfs-utils rpcbind
/mnt/files/stone 172.20.10.2(rw,no_root_squash,no_all_squash,sync)
参数解释如下:
/home/linux265/webapp 为共享的目录,使用绝对路径;
172.20.10.2(rw,no_root_squash,no_all_squash,sync) 为客户端的地址及权限,地址可以是一个网段,一个IP地址或者是一个域名,域名支持通配符,如:*.http://linux265.com,地址与权限中间没有空格;
| 参数 | 作用 |
| ro | 只读 |
| rw | 读写 |
| root_squash | 当NFS客户端以root管理员访问时,映射为NFS服务器的匿名用户 |
| no_root_squash | 当NFS客户端以root管理员访问时,映射为NFS服务器的root管理员 |
| all_squash | 无论NFS客户端使用什么账户访问,均映射为NFS服务器的匿名用户 |
| sync | 同时将数据写入到内存与硬盘中,保证不丢失数据 |
| async | 优先将数据保存到内存,然后再写入硬盘;这样效率更高,但可能会丢失数据 |
exportfs -r
exportfs
systemctl start rpcbind.service
systemctl enable rpcbind.service
systemctl start nfs-server.service
systemctl enable nfs-server.service
客户机
yum install -y showmount
showmount -e
mount 172.20.10.2:/mnt/files/stone /data