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
?
Use the hdfs dfs -ls command to list files in Hadoop archives. Run the hdfs dfs -ls command by specifying the archive directory location.
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).
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With