首页 > 其他分享 >NFS

NFS

时间:2022-10-20 08:44:26浏览次数:38  
标签:rpcbind 192.168 systemctl nfs NFS root

一,NFS (网络文件服务)

NFS是一种基于TCP/IP传输的网络文件系统协议,最初由 sun公司开发
通过使用NFS协议,客户机可以像访问本地目录一样访问远程服务器中的共享资源,NFS 也是NAS 存储设备必然支持的一种协议
NAS存储:
NFS服务的实现依赖于RPC (Remote Processcall,远端过程调用)机制,以完成远程到本地的映射过程。在 centos 7系统中,需要安装nfs-utils、rpcbind 软件包来提供NES 共享服务,前者用于NFS共享发布和访问,后者用于RPC支持。
手动加载NFS共享服务时,应该先启动rpcbind,再启动nfs

nfs端口号2049
RPC端口号111
特点:

采用TCP/IP传输网络文件
安全性低
简单易操作
适合局域网环境

二,实验步骤:
安装nfs和rpcbind软件

修改配置文件设置共享

创建共享目录
开启服务
客户端验证共享目录可访问

rpm -q rpcbind nfs-utils
yum install -y nfs-utils rpcbind
vim /etc/exports#NFS 的配置文件为/etc/exports,文件内容默认为空(无任何共享)/ opt/web 192.168.10.0/24(rw,sync,no_root_squash)
常用选项:

rw
表示允许读写
ro
表示为只读
sync
表示同步写入到内存与硬盘中

no_root_squash
表示当客户机以root身份访问时赋予本地root权限(默认是root_squash),如果不加那么客户端无法在里面编辑或写入文件,因为默认以nfsnobody的权限
root_squash
表示客户机用root用户访问该共享目录时,将root用户映射成匿名用户
其它常用选项:
all_squash
所有访问用户都映射为匿名用户或用户组

async
将数据先保存在内存缓冲区中,必要时才写入磁盘,速度快但会丢失数据42 subtree_check (默认)
若输出目录是一个子目录,则nfs服务器将检查其父目录的权限
no_subtree_check
即使输出目录是一个子目录,nfs服务器也不检查其父目录的权限,这样可以提高效率
systemctl start rpcbind    /需要先启动rpc服务,因为nfs要向rpc注册端口
systemctl start nfs
服务器192.168.118.11上配置:
yum install -y nfs-utils rpcbind
vim /etc/exports
/opt/web 192.168.118.0/24(rw,sync,no_root_squash)
ls /opt/
mkdir -p /opt/web
ls /opt/
systemctl start rpcbind
systemctl start nfs
systemctl enable rpcbind
systemctl enable nfs
netstat -anpu |grep rpc
yum -y install netstat
yum -y install net-tools
netstat -anpu |grep rpc
netstat -anpu |grep nfs
systemctl stop firewalld
setenforce 0
showmount -e 192.168.118.11
exportfs -v

客户机192.168.118.12上配置:
yum -y install nfs-utils rpcbind
showmount -e 192.168.118.11
yum  -y install httpd
ls /var/www/html/
mount -t nfs 192.168.118.11:/opt/web /var/www/html/
df -h
systemctl start httpd
curl 127.0.0.1
echo "Welcome to the Destiny Terminal database" >> /var/www/html/index.html

在浏览器上输入192.168.118.12

标签:rpcbind,192.168,systemctl,nfs,NFS,root
From: https://www.cnblogs.com/y0226/p/16806658.html

相关文章

  • NFS共享存储
    一、NFS共享存储服务概述1、NFS的概念及优点NFS是一种基于TCP/IP传输的网络文件系统协议。通过使用NFS协议,客户机可以像访问本地目录一样访问远程服务器中的共享资源;对......
  • NFS共享磁盘异常
    NFS共享磁盘异常故障描述数据库所挂载的nfs存储网络链路出现中断,所有挂载NFS存储节点所对应的服务均出现异常。故障原因根据哈希算法特性,若业务流量五元组一致(源地址、......
  • kvm使用NFS共享文件夹
    NFS主机配置yum-yinstallnet-toolsyum-yinstallvimyum-yinstallnfs-utilsmkdir/opt/kvmshareecho"/opt/kvmshare192.168.35.10(rw,sync,no_root_squash)"......
  • Linux搭建NFS服务
    欢迎来到千汐 博客名称:千汐染琼博客网址:https://www.cnblogs.com/zhangxiaomin/寄语:无数次从睡梦中醒来,忘记了我是谁worldcookieNFS网络文件系统:(1)基于C/S架构......
  • Kubenetes 部署NFS
    1.StorageClassKubernetes提供了StorageClass来动态创建PV,StorageClass大大简化了PV的创建过程。当申请PVC资源时,如果匹配到满足条件的StorageClass,还会自动为PVC创建对......
  • 安装nfs之ansible-playbook
    ----name:installnfshosts:alltasks:-name:yumnfsyum:name:nfs-utilsstate:presentwhen:ansible_distribution=="CentOS"......
  • NFS服务介绍
    (1)NFS简介NFS网络文件系统提供了一种在类UNIX系统上共享文件的方法。目前NFS有3个版本:NFSv2、NFSv3、NFSv4。CentOS7默认使用NFSv4提供服务,优点是提供了有状态的连接,更容易......
  • ZenFS tutorial
    ZenFSgitclonehttps://github.com/facebook/rocksdb.gitcdrocksdbgitclonehttps://github.com/westerndigitalcorporation/zenfsplugin/zenfssudoDEBUG_LEVEL=......
  • 0565-6.1.0-NFS异常导致Host Monitor及Agent服务错误
    温馨提示:如果使用电脑查看图片不清晰,可以使用手机打开文章单击文中的图片放大查看高清原图。Fayson的github:​​https://github.com/fayson/cdhproject​​提示:代码块部分可......
  • openfst编译首先会遇到下面的错误:
    https://blog.csdn.net/xxm524/article/details/126239910?ops_request_misc=&request_id=&biz_id=102&utm_term=error:%20redeclaration%20%E2%80%98Weight%20f&utm_mediu......