关于nfs套娃的那些事

nfs套娃

起因:因nfs服务器磁盘快爆满了,业务还需拓展,考虑到其他服务器磁盘资源充足,应开发需求,套娃之路从此开始

hostnameipserver
data192.168.1.2nfs-server
image192.168.1.3nfs-server

在这里插入图片描述
原结构

原架构
​ 套娃后结构

第一层套娃

[root@data ~]# yum install -y nfs-utils rpcbind
[root@data ~]# systemctl start rpcbind && systemctl enable rpcbind
[root@data ~]# mkdir /data
[root@data ~]# vim /etc/exports
/data 192.168.1.0/24(rw,no_root_squash,no_all_squash,sync)
[root@data ~]# systemctl start nfs-server && systemctl enable nfs-server
[root@image ~]# yum install -y nfs-utils rpcbind
[root@image ~]# systemctl start rpcbind && systemctl enable rpcbind
[root@image ~]# showmount -e 192.168.1.2
Export list for 192.168.1.2:
/data 192.168.1.0/24
[root@image ~]# mkdir /data
# 挂载第一个nfs
[root@image ~]# mount 192.168.1.2:/data /data
[root@image ~]# vim /etc/fstab
# 配置开机挂载
192.168.1.2:/data /data nfs defaults 0 0 
# 测试第一个nfs
[root@data ~]# touch /data/test1
[root@image ~]# ls /data
test1
[root@image ~]# touch /data/test2
[root@data ~]# ls /data
test1 test2

第二层套娃

[root@image ~]# mkdir /image
[root@image ~]# vim /etc/exports
/image 192.168.1.0/24(rw,no_root_squash,no_all_squash,sync)
[root@image ~]# systemctl start nfs-server && systemctl enable nfs-server
[root@data ~]# showmount -e 192.168.1.3
Export list for 192.168.1.3:
/image 192.168.1.0/24
[root@data ~]# mkdir /data/image
[root@data ~]# mount 192.168.1.3:/image /data/image
[root@data ~]# vim /etc/fstab
192.168.1.3:/image /data/image nfs defaults 0 0 
# 这里192.168.1.3也需要挂载,否则192.168.1.3无法获取到192.168.1.2:/data/image的信息,只有在192.168.1.3:/image才有记录,192.168.1.3:/data/image不会有记录
# 以下为只在192.168.1.2挂载的测试记录
[root@data ~]# touch /data/image/test3
[root@data ~]# ls /data/image
test3
[root@image ~]# ls /data/image
# 此时返回为空
[root@image ~]# ls /image
test3
[root@image ~]# mount 192.168.1.3:/image /data/image
[root@image ~]# vim /etc/fstab
192.168.1.3:/image /data/image nfs defaults 0 0
[root@image ~]# ls /data/image
test3
[root@image ~]# touch /data/image/test4
[root@image ~]# ls /data/image
test3 test4
[root@image ~]# ls /image
test3 test4
[root@data ~]# ls /data/image
test3 test4
[root@data ~]# touch /data/image/test5
[root@data ~]# ls /data/image
test3 test4 test5
[root@image ~]# ls /data/image
test3 test4 test5
[root@image ~]# ls /image
test3 test4 test5
# 至此套娃结束
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值