在我的系统变量中, HADOOP_HOME
设置为 C:\hadoop-2.7.2\bin
我尝试使用以下代码访问hdfs:
FileSystem hdfs = FileSystem.get(new Configuration());
Path homeDir = hdfs.getHomeDirectory();
运行时错误:
17/03/13 10:49:39 ERROR util.Shell: Failed to locate the winutils binary in the hadoop binary path
java.io.IOException: Could not locate executable C:\hadoop-2.7.2\bin\bin\winutils.exe in the Hadoop binaries.
at org.apache.hadoop.util.Shell.getQualifiedBinPath(Shell.java:379)
at org.apache.hadoop.util.Shell.getWinUtilsPath(Shell.java:394)
at org.apache.hadoop.util.Shell.<clinit>(Shell.java:387)
at org.apache.hadoop.util.StringUtils.<clinit>(StringUtils.java:80)
at org.apache.hadoop.fs.FileSystem$Cache$Key.<init>(FileSystem.java:2823)
at org.apache.hadoop.fs.FileSystem$Cache$Key.<init>(FileSystem.java:2818)
at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2684)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:373)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:172)
如何更改代码访问的路径 C:\hadoop-2.7.2\bin\bin\winutils.exe
至 C:\hadoop-2.7.2\bin\winutils.exe
因为前一个不是有效的目录?
1条答案
按热度按时间1bqhqjot1#
更新
Path variable
如下面的截图和地点winutils.exe
在hadoop-2.x/bin/