windows本地挂载HDFS

1、修改配置文件

进入配置文件目录:

cd ${HADOOP_HOME}/etc/hadoop

修改core-site.xml:

vim core-site.xml

在文件中增加以下内容:

<property>
  <name>hadoop.proxyuser.root.groups</name>
  <value>*</value>
  <description>
         The 'nfsserver' user is allowed to proxy all members of the 'users-group1' and
         'users-group2' groups. Note that in most cases you will need to include the
         group "root" because the user "root" (which usually belonges to "root" group) will
         generally be the user that initially executes the mount on the NFS client system.
         Set this to '*' to allow nfsserver user to proxy any group.
  </description>
</property>

<property>
  <name>hadoop.proxyuser.root.hosts</name>
  <value>*</value>
  <description>
         This is the host where the nfs gateway is running. Set this to '*' to allow
         requests from any hosts to be proxied.
  </description>
</property>

修改hdfs-site.xml:

vim hdfs-site.xml

在文件中增加以下内容(ip等需要根据实际情况修改):

<property>
    <name>nfs.superuser</name>
    <value>root</value>
</property>
 <property>
    <name>dfs.namenode.accesstime.precision</name>
    <value>3600000</value>
    <description>The access time for HDFS file is precise upto this value.
           The default value is 1 hour. Setting a value of 0 disables
           access times for HDFS.
     </description>
</property>
<property>
     <name>nfs.dump.dir</name>
     <value>/tmp/.hdfs-nfs</value>
</property>
<property>
     <name>nfs.exports.allowed.hosts</name>
     <value>192.168.16.* rw</value>
</property>

修改log4j.properties:

vim log4j.properties

在最后增加以下内容:

log4j.logger.org.apache.hadoop.hdfs.nfs=DEBUG
log4j.logger.org.apache.hadoop.oncrpc=DEBUG

2、关闭系统服务

#使用root权限停止系统本身的服务
service nfs stop
service rpcbind stop

3、启动服务

#重启Hadoop服务
start-all.sh
#查看进程是否正确
jps
#后台开启hadoop自带的portmap服务,需要root权限
hadoop-daemon.sh start portmap 

#后台开启hadoop自带的nfs服务,注意:启动该服务的用户需要与启动Hadoop集群的用户一致
hadoop-daemon.sh start nfs3

验证查看rpc的挂载情况:

rpcinfo -p ${nfs服务器ip}

4、开启windows的NFS服务(windows10)

进入控制面板选择程序和功能:

点击启用或关闭windows功能:

勾选NFS服务:

注:如果此处没有NFS服务证明当前Windows环境是家庭版,请升级到企业版或专业版后开启服务。升级方法如下:

此电脑 -> 属性 -> 更改产品密钥 -> 输入产品密钥 -> 验证成功后等待升级完成

#以下两条密钥如果都验证失败,请自行搜索其他密钥
J7QT3-3GCPG-9GVWT-CH2XR-GMRJM
VK7JG-NPHTM-C97JM-9MPGT-3V66T

5、挂载

#在一个局域网内的windows 系统挂载 centos7 的 HDFS 文件系统使用命令:
net use X: \\${nfs服务器ip}\!

查看挂载情况:

到此挂载完成!!!

注:如果出现如下情况,请检查配置文件是否配置正确以及使用jps命令查看进程是否成功启动。

#如果需要结束挂载点使用以下命令
net use X: /del
posted @ 2021-06-16 10:36  Leil_blogs  阅读(687)  评论(0编辑  收藏  举报