Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

find file in hadoop filesystem

Is there a way to locate a specific file in hadoop?

I know, that I can use this: hadoop fs -find /some_directory

But, is there a command like this: hadoop locate some_file_name?

like image 884
Headmaster Avatar asked Mar 20 '17 12:03

Headmaster


People also ask

How do I find a file in Hadoop?

Use the hdfs dfs -ls command to list files in Hadoop archives. Run the hdfs dfs -ls command by specifying the archive directory location.

How do I find the path of a file in HDFS?

You can look for the following stanza in /etc/hadoop/conf/hdfs-site. xml (this KVP can also be found in Ambari; Services > HDFS > Configs > Advanced > Advanced hdfs-site > dfs. namenode. rpc-address).

How do I find a directory in Hadoop?

Using the ls command, we can check for the directories in HDFS. Hadoop HDFS mkdir Command Description: This command creates the directory in HDFS if it does not already exist.


1 Answers

If you are looking for equivalent of locate Linux command than such option does not exist in Hadoop. But if you are looking for the way of how to find specific file you can use name parameter of fs -find command for this:

hadoop fs -find /some_directory -name some_file_name

If you are looking for the actual location of hdfs file in your local file system you can use fsck command for this:

hdfs fsck /some_directory/some_file_name -files -blocks -locations
like image 87
Alex Avatar answered Nov 08 '22 21:11

Alex