【问题标题】:Command "hadoop fs -ls ." does not work命令“hadoop fs -ls”。不工作
【发布时间】:2016-05-27 20:13:30
【问题描述】:

我想我已经正确安装了 hadoop。如果我做jps我可以看到namenode和datanode,没问题。

当我输入 hadoop fs -ls . 时,我得到了错误:

Java HotSpot(TM) 64-Bit Server VM warning: You have loaded library /opt/db/hadoop-2.4.1/lib/native/libhadoop.so.1.0.0 which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
14/08/08 12:42:44 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
ls: '.': No such file or directory

当我输入 hadoop dfs -ls . 时,我得到了错误:

DEPRECATED: Use of this script to execute hdfs command is deprecated.
Instead use the hdfs command for it.

Java HotSpot(TM) 64-Bit Server VM warning: You have loaded library /opt/db/hadoop-2.4.1/lib/native/libhadoop.so.1.0.0 which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
14/08/08 12:43:27 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
ls: '.': No such file or directory

当我输入 hadoop hdfs -ls . 时,我得到了错误:

Error: Could not find or load main class hdfs

这与我是否输入'.'无关或“/”或我所在的任何目录。

这一切意味着什么?如何获得正常的预期输出?我错过了什么?

【问题讨论】:

  • export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native export HADOOP_OPTS="-Djava.library.path=$HADOOP_HOME/lib" 在 .bashrc 中添加这两行并重新打开终端并尝试重新启动 hadoop。
  • 你重启了hadoop了吗?
  • 哦...不,我会那样做。我意识到它无论如何都消除了警告,这很棒!我现在重新开始
  • 试试hadoop dfs -ls /
  • 好的,如果我尝试 'hadoop dfs -ls /' 我会得到以下信息:DEPRECATED: Use of this script to execute hdfs command is deprecated. Instead use the hdfs command for it. 14/08/08 12:59:47 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

标签: hadoop hdfs


【解决方案1】:

使用

hdfs dfs -ls ...

我认为没有hadoop hdfs这样的东西

【讨论】:

  • 对我的输出没有任何影响!我实际上发现hadoop最终确实有效:)
【解决方案2】:

使用命令如下

bin/hadoop fs -ls /

【讨论】: