• Centos7配置NFS


    centos7配置nfs

      yum -y install nfs-utils rpcbind

      设置服务开机启动:

        systemctl enable rpcbind

        systemctl enable nfs-server

        systemctl enable nfs-lock

        systemctl enable nfs-idmap

      启动nfs服务:

        systemctl start rpcbind

           systemctl start nfs-server

        systemctl start nfs-lock

           systemctl start nfs-idmap

      建立共享目录:

        mkdir -p /nfs

        chmod -R 777 /nfs (最好用下边的方法)

        chown nfsnobody:nfsnobody /nfs

      配置需要共享的目录到 /etc/exports

        vim /etc/exports

        /nfs 192.168.10.*(rw,sync,no_root_squash)

      注:如果端口大于1024

        查看端口号:

          netstat -lnp

    tcp        0      0 0.0.0.0:20048           0.0.0.0:*               LISTEN      23636/rpc.mountd
    

         如端口号大于1024则需要添加insecure参数

        vim /etc/exports

        /nfs 192.168.10.*(insecure,rw,sync,no_root_squash)

        注意和挂载机要为同网段,多网段情况可以用 ‘ * ’

        /nfs/iso        *(insecure,rw,sync,all_squash) 

      重新加载:

        exportfs -rv

      查看是否挂载:

        showmount -e

     客户端配置:注:客户端不需要启动nfs!

       安装nfs:

         yum -y install nfs-utils

        查看nfs共享目录:

         showmount -e 192.168.x.x

       建立目录:

         mkdir /nfs

       挂载nfs:

         mount -t nfs 192.168.x.x:/nfs /nfs

        如需要卸载:

         umount /nfs

       查看挂载情况:

         df

        配置客户端开机自动挂载nfs共享目录

           vim /etc/fstab

       添加   192.168.x.x:/nfs /nfs nfs defaults 0 0

          

       配置nfs目录:

         vim /etc/crate/crate.yml

       卸载目录:

        umount /nfs

        或

        exportfs -a

          exportfs命令

            -a 全部挂载或者全部卸载

            -r 重新挂载

            -u 卸载某一个目录

            -v 显示共享目录

    感谢:

    http://linux.vbird.org/linux_server/0330nfs.php  (很详细)

    https://blog.csdn.net/xht555/article/details/80464578

    https://my.oschina.net/u/3707314/blog/1608108

  • 相关阅读:
    UVaLive 7362 Farey (数学,欧拉函数)
    UVaLive 7361 Immortal Porpoises (矩阵快速幂)
    UVaLive 7359 Sum Kind Of Problem (数学,水题)
    CodeForces 706D Vasiliy's Multiset (字典树查询+贪心)
    负载均衡服务器
    集群-如何理解集群?
    架构规划
    领域模型
    状态图
    E-R图
  • 原文地址:https://www.cnblogs.com/jackyzm/p/10285845.html
Copyright © 2020-2023  润新知