nfs共享存储服务

一、NFS概述

nfs共享存储服务 全称:netwoke file system 在计算机网络中共享文件系统的协议。

计算机之间可以通过网络共享目录和文件

rpcbind 远程共享调用

nfs 共享服务

配置nfs时,要先启动调用rpcbind在开启nfs

rpcbind端口111

nfs 2049(查询不到)

二、实验

实现指定主机进行共享

1、首先在opt目录下创建gx目录

主机ip192.168.10.20

vim /etc/exports

/opt/gx 192.168.10.40(rw,sync,no_root_squash)

主机也可以实现在同一网段下的所有主机均可访问,

192.168.10.0/24声明网段,谁可以访问本机的共享目录

rw读写 ro只读

sync同步写入到硬中(共享用户的操作)

no_root_squash如果客户机root用户访问共享目录,就给你和本机的root用户一样的权限

root_squash客户机root用户登录访问共享目录,就会把你变成匿名用户

vim /etc/exports

/opt/gx 192.168.10.0/24(rw,sync,no_root_squash) #192.168.10.0网段

2、安装服务

[root@localhost ~]# yum -y install rpcbind

[root@localhost ~]# yum -y install nfs-utils.x86_64

重启rpcbind在启动nfs

[root@localhost /]# systemctl restart rpcbind

[root@localhost /]# systemctl restart nfs

showmount -e 查看本机共享出去的目录

[root@localhost /]# showmount -e

Export list for localhost.localdomain:

/opt/gx 192.168.10.40

客户机 ip192.168.10.40

安装服务

[root@localhost ~]# yum -y install rpcbind

[root@localhost ~]# yum -y install nfs-utils.x86_64

重启rpcbind在启动nfs

[root@localhost /]# systemctl restart rpcbind

[root@localhost /]# systemctl restart nfs

showmount -e 192.168.10.20 查看目标主机暴露出的共享目录

[root@localhost test1]# showmount -e 192.168.10.20

Export list for 192.168.10.20:

/opt/gx 192.168.10.40

挂载

[root@localhost opt]# mount 192.168.10.20:/opt/gx /opt/test1

永久挂载

永久

192.168.10.20:/opt/gongxiang /opt/tests1 nfs defaults,_netdev 0 0

# _netdev :有网络该目录才能挂载成功

实现共享,均可对文件进行增删改查等操作

主机

 客户机

  • 10
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值