windows10下操作HDFS报错:Failed to locate the winutils binary in the hadoop binary path(防坑篇)

今天在Windows上面操作Linux下的HDFS,结果一直报这个错误,搞了好长时间才解决,所以记录一下,让他人和自己少入坑。

错误详情:

ERROR Shell: Failed to locate the winutils binary in the hadoop binary path
java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries.
  at org.apache.hadoop.util.Shell.getQualifiedBinPath(Shell.java:318)
  at org.apache.hadoop.util.Shell.getWinUtilsPath(Shell.java:333)
  at org.apache.hadoop.util.Shell.<clinit>(Shell.java:326)
  at org.apache.hadoop.util.StringUtils.<clinit>(StringUtils.java:76)

错误解析:不难发现,它提示的是在Windows上找不到winttils.exe文件,因为在windows上远程调试hadoop需要安装有这个文件,所以你需要下载这个文件并配置HADOOP_HOME环境变量就能解决了。不过,你下载的这个文件版本要和你的hadoop版本对应,不然可能还会报错(我的当时版本没对应依然还是报错)。

下载地址:https://blog.csdn.net/qq_43437122/article/details/105026049
在这里插入图片描述
1.找到你所需的版本,然后将对应版本文件夹下的bin目录复制到一个目录下,这里你自己定义,因为要配置环境变量。我放在了D盘下。
在这里插入图片描述
2.配置环境变量

先建立HADOOP_HOME系统环境变量,值为你刚才bin文件的父目录的路径,如图:
在这里插入图片描述
然后在Path下配置文件路径,如图(按图示填写,别写错了):
在这里插入图片描述
然后重启电脑,再次运行程序发现错误解决。一定要注意环境变量的配置,按上面的步骤操作,不然可能会出错。

发布了81 篇原创文章 · 获赞 69 · 访问量 8939

猜你喜欢

转载自blog.csdn.net/qq_43437122/article/details/105025928