我遇到了一个奇怪的问题,我无法在我的 hdfs 中看到文件。每当我执行 hadoop fs -ls
时,我都会收到以下错误:
hadoop fs -ls
Warning: $HADOOP_HOME is deprecated.
ls: Cannot access .: No such file or directory.
我可以使用诸如 copyfromlocal 等命令,但仍然无法在 hdfs 中看到它们,由于这个问题也无法运行 pig 脚本。 如果我执行 hadoop fs -ls/* 我得到以下错误:
hadoop fs -ls /*
Warning: $HADOOP_HOME is deprecated.
Found 1 items
drwxr-xr-x - hduser hadoop 0 2014-02-14 16:49 /app/hadoop
ls: Cannot access /bin: No such file or directory.
ls: Cannot access /boot: No such file or directory.
ls: Cannot access /Data: No such file or directory.
ls: Cannot access /dev: No such file or directory.
ls: Cannot access /etc: No such file or directory.
Found 1 items
drwxr-xr-x - hduser hadoop 0 2014-02-19 13:02 /home/hduser
ls: Cannot access /lib: No such file or directory.
ls: Cannot access /lib64: No such file or directory.
ls: Cannot access /lost+found: No such file or directory.
ls: Cannot access /media: No such file or directory.
ls: Cannot access /misc: No such file or directory.
ls: Cannot access /mnt: No such file or directory.
ls: Cannot access /net: No such file or directory.
ls: Cannot access /opt: No such file or directory.
ls: Cannot access /proc: No such file or directory.
ls: Cannot access /root: No such file or directory.
ls: Cannot access /sbin: No such file or directory.
ls: Cannot access /selinux: No such file or directory.
ls: Cannot access /srv: No such file or directory.
ls: Cannot access /sys: No such file or directory.
ls: Cannot access /tftpboot: No such file or directory.
ls: Cannot access /usr: No such file or directory.
ls: Cannot access /var: No such file or directory.
ls: Cannot access /zookeeper.out: No such file or directory.
ls: Cannot access /zookeeper_server.pid: No such file or directory.
任何人都可以让我知道这里可能是什么问题吗? 我有一个工作正常的 7 节点 hadoop 集群。我大约在 2 天前遇到了这个问题。已尝试重启集群、重启节点等,但仍然面临同样的问题。
谢谢,
最佳答案
你的hadoop没有问题
hadoop fs -ls
没有显示任何输出,因为当前用户的主目录中没有目录或文件(您正在从中执行命令)
请按以下方式运行第二个命令
hadoop fs -ls /
代替
hadoop fs -ls /*
这会很好地工作,并会为您提供正确的输出。
关于linux - 看不到 hdfs,Hadoop shell 命令 hadoop fs -ls 给出错误无法访问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21898771/