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

    一、NFS简介

      端口号:TCP、UDP 111 端口   (这是RPC的端口,NFS没有固定端口)

      NFS(Network File System)网络文件系统,是一种基于 TCP/IP 传输的网络文件系统协议,最初由 SUM 公司开发。通过使用

    NFS协议,客户机可以像访问本地目录一样访问远程服务器中的共享资源。

      NFS 没有用户认证机制,而且数据在网络上明文传输,所以安全性很差,一般只能在局域网中使用。NFS服务的实现依赖于 RPC

    (Remote Process Call)远程过程调用机制,以完成远程到本地的映射过程。

      nfs-utils软件包用于NFS共享发布和访问,rpcbind软件包用于RPC支持。

    二、搭建nfs服务共享文件

      • 1

        在服务器端安装NFS服务软件包并开启,服务器地址:192.168.5.21

        [ root@localhost ~] # mount /dev/sr0 /media
        [ root@localhost ~] # yum -y install nfs-utils rpcbind
        [ root@localhost ~] # systemctl start nfs
        [ root@localhost ~] # systemctl start rpcbind
      • 2

        关闭防火墙

        [ root@localhost ~] # iptables -F
        [ root@localhost ~] # setenforce 0
        [ root@localhost ~] # systemct. stop firewalld
      • 3

        创建共享目录

        [ root@localhost ~] # mkdir /nfs
        [ root@localhost ~] # cp -ar /media/* /nfs
        [ root@localhost ~] # cp
      • 4

        编辑nfs配置文件:/etc/exports

        在文件中写入:/nfs    192.168.5.0/24(sync)

      • 5

        在服务端查看可挂载nfs共享目录信息

        [root@localhost ~]# showmount -e 192.168.5.21
        Export list for 192.168.5.21:
        /nfs 192.168.5.0/24

      • 6

        在客户端安装NFS服务软件包并开启,创建共享目录并挂载

        [ root@localhost ~] # mount /dev/sr0 /media
        [ root@localhost ~] # yum -y install nfs-utils rpcbind
        [ root@localhost ~] # systemctl start nfs
        [ root@localhost ~] # systemctl start rpcbind

        [ root@localhost ~] # mkdir /var/nfs/html

        [ root@localhost ~] # mount 192.168.5.21:/nfs /var/nfs/html 

      • 7

        在客户端使用df命令查看,发现已经挂载成功

        rhel/centos7中搭建nfs服务共享文件
      • 8

        在服务端拷贝一个文件到共享目录中

        rhel/centos7中搭建nfs服务共享文件
      • 9

        在客户端可以看到服务端拷贝的文件,验证成功。

        rhel/centos7中搭建nfs服务共享文件
  • 相关阅读:
    HBase原理和架构
    Hive UDF作业
    Hive性能调优
    hive
    Netty4.0学习笔记系列之一:Server与Client的通讯
    JAVA NIO 简介(转)
    设计模式之观察者模式(Observer Pattern)
    设计模式之装饰者模式(Decorator Pattern)
    mysql存储过程写法—动态参数运用
    hashCode() 和equals() 区别和作用
  • 原文地址:https://www.cnblogs.com/2567xl/p/11387670.html
Copyright © 2011-2022 走看看