zoukankan      html  css  js  c++  java
  • 8.24NFS介绍、NFS服务端安装配置、NFS配置选项

    1、NFS介绍

      NFS是Network File System的缩写,NFS版本更新比较慢。

      NFS数据传输基于RPC协议,RPC为Remote Procedure Call的简写。

      NFS应用场景是:A,B,C三台机器上需要保证被访问到的文件是一样的,A共享数据出来,B和C分别去挂载A共享的数据目录,从而B和C访问到的数据和A上的一致

     2、NFS服务端安装配置

      服务端:192.168.133.130

      客户端:192.168.133.132

      服务端安装两个包:yum install -y nfs-utils rpcbind

      客户端需要安装一个包:yum install -y nfs-utils

      编辑配置文件:vim /etc/exports并增加如下内容

      /home/nfstestdir  192.168.133.0/24(rw,sync,all_squash,anonuid=1000,anongid=1000)//指定分享出去的目录和共享的网段

      mkdir /home/nfstestdir  //创建共享的目录

      chmod 777 /home/nfstestdir  //为了方便实验,需要将共享目录权限修改为777

      systemctl start rpcbind  //启动rpcbind

      systemctl start nfs  //启动NFS

      systemctl enable rpcbind  //配置rpc开机启动

      systemctl enable nfs  //配置nfs开机启动

    3、NFS配置选项

      rw 读写

      ro 只读

      sync 同步模式,内存数据实时写入磁盘,会降低磁盘效率

      async 非同步模式,每隔一段时间刷入一次

      no_root_squash 客户端挂载NFS共享目录后,root用户不受约束,权限很大

      root_squash 与上面选项相对,客户端上的root用户收到约束,被限定成某个普通用户

      all_squash 客户端上所有用户在使用NFS共享目录时都被限定为一个普通用户

      anonuid/anongid 和上面几个选项搭配使用,定义被限定用户的uid和gid

       客户端挂载:

      yum install -y nfs-utils

      showmount -e 192.168.133.130 //该ip为NFS服务端ip,此时可能会出现网络连接不通的告警,因为进行连接时,使用了一个随机端口,所以需要将客户端和服务器的防火墙都关闭,执行systemctl stop firewalld  和setenforce 0命令

      mount -t nfs 192.168.133.130:/home/nfstestdir /mnt

      df -h

      touch /mnt/aminglinux.txt

      ls -l /mnt/aminglinux.txt //可以看到文件的属主和属组都是1000

  • 相关阅读:
    hdu1848(sg函数打表)
    hdu1850(nim博弈)
    hdu1847(sg函数&yy)
    hdu2147(yy)
    poj2133(sg函数)
    Educational Codeforces Round 18D(完全二叉树中序遍历&lowbit)
    atcoder057D(组合数模板)
    euler证明
    04_过滤器Filter_04_Filter生命周期
    04_过滤器Filter_03_多个Filter的执行顺序
  • 原文地址:https://www.cnblogs.com/w494129131/p/9508339.html
Copyright © 2011-2022 走看看