安装NFS

  1. yum install -y nfs-utils

主节点执行

echo "/nfs/data/ *(insecure,rw,sync,no_root_squash)" > /etc/exports

mkdir -p /nfs/data
systemctl enable rpcbind --now
systemctl enable nfs-server --now

exportfs -r

从节点

showmount -e 172.21.0.6
mkdir -p /nfs/data

mount -t nfs 172.21.0.6:/nfs/data /nfs/data
echo "hello nfs server" > /nfs/data/test.txt