在hadoop中有一个相当于find命令的命令吗? [英] Is there the equivalent for a `find` command in `hadoop`?
问题描述
我知道从终端可以执行find
命令来查找文件,例如:
I know that from the terminal, one can do a find
command to find files such as :
find . -type d -name "*something*" -maxdepth 4
但是,当我处于hadoop文件系统中时,我还没有找到实现此目的的方法.
But, when I am in the hadoop file system, I have not found a way to do this.
hadoop fs -find ....
引发错误.
人们如何遍历hadoop中的文件?我正在使用hadoop 2.6.0-cdh5.4.1
.
How do people traverse files in hadoop? I'm using hadoop 2.6.0-cdh5.4.1
.
推荐答案
hadoop fs -find
是Apache Hadoop 2.7.0中引入的.很可能您使用的是旧版本,因此您还没有该版本.
请参阅: HADOOP-8989 .
hadoop fs -find
was introduced in Apache Hadoop 2.7.0. Most likely you're using an older version hence you don't have it yet.
see: HADOOP-8989 for more information.
在此期间您可以使用
hdfs dfs -ls -R <pattern>
例如: hdfs dfs -ls -R/demo/order *.*
e.g,: hdfs dfs -ls -R /demo/order*.*
但这当然不如查找"功能强大,并且缺少一些基础知识.据我了解,人们一直在围绕它编写脚本来克服这个问题.
but that's not as powerful as 'find' of course and lacks some basics. From what I understand people have been writing scripts around it to get over this problem.
这篇关于在hadoop中有一个相当于find命令的命令吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!