zoukankan      html  css  js  c++  java
  • NFS服务

    NFS服务

    【部署前准备】

    软件包:

    nfs-utils:NFS服务的主程序,包括rpc.nfsd、rpc.mountd这两个daemons和相关文档说明,以及执行命令文件等。

    rpcbind:Centos6.X下面RPC的主程序。NFS可以视为一个RPC程序,在启动任何一个RPC程序之前,需要做好端口和功能的对应映射工作,这个映射工作就是由rpcbind服务来完成的。因此,在提供NFS服务之前必须先启动rpcbind服务才行。

    【部署过程-服务端

    1、 检查是否有安装软件包(nfs-utils、rpcbind)。

    rpm -qa nfs-utils rpcbind

    若没有可以采用yum命令安装:yum install -y nfs-utils rpcbind

    若有安装,检查是否开启了服务:netstat -ntulp | grep rpc

    若没有开启服务,先开启rpcbind服务:/etc/init.d/rpcbind start

    再次检查rpc服务是否启动:netstat -ntulp | grep rpc

    检查nfs服务是否有启动:netstat -ntulp | grep nfs

    若nfs服务未启动,则开启:/etc/init.d/nfs start

    检查rpc是否能有监测nfs:rpcinfo -p localhost

    2、 创建共享目录:mkdir /data -p

    查看nfs服务用户:id nfsnobody

    查看共享目录属性:ls -ld /data/

    修改共享目录属主、属组:chown -R nfsnobody.nfsnobody /data

    再次查看共享目录属性,看是否属主、属组修改成功:ls -ld /data

    3、 编辑nfs配置文件

    vim /etc/exports

    /data 172.16.1.0/24(rw,sync)

    4、 设置开机自启动并检查是否生效

    chkconfig nfs on

    chkconfig rpcbind on

    chkconfig --ist nfs

    chkconfig –list rpcbind

    写入rc.local文件

    echo “/etc/init.d/rpcbind start” >>/etc/rc.local

    echo “/etc/init.d/nfs start” >>/etc/rc.local

    cat /etc/rc.local

    5、 平滑重启nfs服务

    /etc/init.d/nfs reload

    检查服务

    showmount -e 172.16.1.31

    测试服务在本地是否正常:

    mount -t nfs 172.16.1.31:/data /mnt

    umount /mnt

    【部署过程-客户端

    1、 检查是否有安装软件包(nfs-utils、rpcbind)。

    rpm -qa nfs-utils rpcbind

    若没有可以采用yum命令安装:yum install -y nfs-utils rpcbind

    若有安装,检查是否开启了服务

    netstat -ntulp | grep rpc

    若没有开启服务,先开启rpcbind服务

    /etc/init.d/rpcbind start

    再次检查rpc服务是否启动:netstat -ntulp | grep rpc

    查看rpcbind服务状态:/etc/init.d/rpcbind status

    2、 设置开机自启动并检查

    chkconfig rpcbind on

    chkconfi –list rpcbind

    echo “/etc/init.d/rpcbind start” >>/etc/rc.local

    cat /etc/rc.local

    3、 查看服务端的NFS是否OK

    showmount -e 172.16.1.31

    4、 挂载测试

    mount -t nfs 172.16.1.31:/data /mnt

    cd /mnt

    ls -l

    touch test001.txt

    ls -l

    5、 设置开机启动自动挂载

    echo “mount -t nfs 172.16.1.31:/data /mnt” >>/etc/rc.local

    nfs原理图:

  • 相关阅读:
    LeetCode Find Duplicate File in System
    LeetCode 681. Next Closest Time
    LeetCode 678. Valid Parenthesis String
    LeetCode 616. Add Bold Tag in String
    LeetCode 639. Decode Ways II
    LeetCode 536. Construct Binary Tree from String
    LeetCode 539. Minimum Time Difference
    LeetCode 635. Design Log Storage System
    LeetCode Split Concatenated Strings
    LeetCode 696. Count Binary Substrings
  • 原文地址:https://www.cnblogs.com/tcheng/p/8506741.html
Copyright © 2011-2022 走看看