30 lines
560 B
Markdown
30 lines
560 B
Markdown
1、所有节点
|
|
```
|
|
#所有机器安装
|
|
yum install -y nfs-utils
|
|
```
|
|
|
|
2、主节点
|
|
```
|
|
#nfs主节点
|
|
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
|
|
```
|
|
|
|
3、从节点
|
|
```
|
|
showmount -e 主节点ip
|
|
|
|
#执行以下命令挂载 nfs 服务器上的共享目录到本机路径 /root/nfsmount
|
|
mkdir -p /nfs/data
|
|
|
|
mount -t nfs 主节点ip:/nfs/data /nfs/data
|
|
# 写入一个测试文件
|
|
echo "hello nfs server" > /nfs/data/test.txt
|
|
```
|