NFS的部署


以下内容来自:http://blog.csdn.net/piaojinwodeshijie/article/details/62416718

服务器:

1、安装nfs 和 rpcbind

        安装nfs-utils ,rpcbind:

           yum -y install nfs-utils ,rpcbind

       查看是否安装:

           rpm -qa |grep nfs

           rpm -qa |grep rpcbind


2、关闭防火墙:

      关闭防火墙

       systemctl stop firewalld.service   /service iptables stop


        禁止防火墙开机自启动

       systemctl disable firewalld.service  /service iptables disable



3、启动服务:一定要先启动rpc,然后启动nfs

       nfs需要向rpc注册,rpc一旦重启,所以注册的文件都丢失,其他向注册的服务都需要重启

       启动rpc服务:

             systemctl start   rpcbind.service    /service rpbind start  

      启动nfs服务: 

            systemctl start  nfs.service  /service nfs start


4、设置开机自启动

     设置rpc自己自启动:

         systemctl enable rpcbind.service  /service rpcbind enable

      设置rpc自己自启动 :  

         systemctl enable nfs.service  /service nfs enable

    

5、查看rpc ,nfs状态

        查看rpc状态:active

               systemctl status rpcbind.service  /service rpcbind status

         查看nfs状态:active

              systemctl status nfs.service  /service nfs status


6、在/etc/exports设置NFS服务共享文件夹的位置

       vim /etc/exports:       

       /etc/exports追加:/home/grid  *(rw,sync,no_root_squash) 

       参数解释:

              /home/grid 共享的目录

               * :任何人

               rw :读写权限

               sync:资料会先暂存于内存中,而非直接写入硬盘。

               no_root_squash:当登录NFS主机使用共享目录的使用者是root时,其权限将被转换成为匿名使用者,通常它的UID与GID                                             都会变成nobody身份。


7、重启rpcbind 然后重启 nfs:

    重启rpc服务:

             systemctl restart  rpcbind.service      

      重启nfs服务: 

            systemctl restart  nfs.service



客户端

1、安装nfs 和 rpcbind

        安装nfs-utils ,rpcbind:

           yum -y install nfs-utils ,rpcbind

       查看是否安装:

           rpm -qa |grep nfs

           rpm -qa |grep rpcbind


2、关闭防火墙:

      关闭防火墙

       systemctl stop firewalld.service

        禁止防火墙开机自启动

       systemctl disable firewalld.service



3、启动服务:一定要先启动rpc,然后启动nfs

       nfs需要向rpc注册,rpc一旦重启,所以注册的文件都丢失,其他向注册的服务都需要重启

       启动rpc服务:

             systemctl start   rpcbind.service      

      启动nfs服务: 

            systemctl start  nfs.service


4、设置开机自启动

     设置rpc自己自启动:

         systemctl enable rpcbind.service

      设置rpc自己自启动 :  

         systemctl enable nfs.service

    

5、查看rpc ,nfs状态

        查看rpc状态:active

               systemctl status rpcbind.service

         查看nfs状态:active

              systemctl status nfs.service


6、在所有客户端挂载服务器132.117.200.60的/home/grid目录

        查看132.117.200.60服务器可挂载的目录:

               showmount -e 192.168.20.128

        在客户端的根目录下建立nfs_share目录

               mkdir /nfs_share

        进行挂载:

               mount -t nfs 132.117.200.60:/home/grid   /nfs_share

         取消挂载:

              umount  /nfs_share

7、设置客户端开机时自动挂载132.117.200.60:/home/grid到本地的/nfs_share

          在root用户下:

           vim /etc/fstab

            追加:192.168.20.128:/home/grid  /nfs_share   #开机时自动将/home/grid挂在到nfs_share


服务器:共享秘钥

生成秘钥

      切换到grid用户:

            su grid

   cd 

      grid用户下产生ssh秘钥

              ssh-keygen -t rsa

     

复制秘钥到/.ssh/authorized_keys

       cd .ssh/

        #复制本地秘钥

           cat ~/.ssh/id_ras.pub >>~/.ssh/authorized_keys

       #复制use1和use2的秘钥

           ssh use1.hadoop.com cat ~/.ssh/id_ras.pub >>~/.ssh/authorized_keys

           ssh use2.hadoop.com cat ~/.ssh/id_ras.pub >>~/.ssh/authorized_keys


修改authorized_keys文件权限

       将authorized_keys权限从664 -> 644 

       chmod 644 authorized_keys


客户端:建立authorized_keys软连接

grid 用户下

    su grid

     cd .ssh/

建立软连接:

       ln -s /nfs_share/.ssh/authorized_keys ~/.ssh/authorized_keys

测试免密码登录是否成功

      ssh user.hadoop.com


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值