I have been using Cloudera's hadoop (0.20.2). With this version, if I put a file into the file system, but the directory structure did not exist, it automatically created the parent directories:
So for example, if I had no directories in hdfs and typed:
hadoop fs -put myfile.txt /some/non/existing/path/myfile.txt
It would create all of the directories: some, non, existing and path and put the file in there.
Now, with a newer offering of hadoop (2.2.0) this auto creation of directories is not happening. The same command above yields:
put: ` /some/non/existing/path/': No such file or directory
I have a workaround to just do hadoop fs -mkdir first, for every put, but this is not going to perform well.
Is this configurable? Any advice?
Hadoop HDFS mkdir Command Description:This command creates the directory in HDFS if it does not already exist. Note: If the directory already exists in HDFS, then we will get an error message that file already exists. Use hadoop fs mkdir -p /path/directoryname, so not to fail even if directory exists.
1. mkdir: This is no different from the UNIX mkdir command and is used to create a directory on an HDFS environment. mention not to fail if the directory already exists.
Now you should use hadoop fs -mkdir -p <path>
EDITORIAL NOTE: WARNING THIS ANSWER IS INDICATED TO BE INCORRECT
hadoop fs ...
is deprecated instead use : hdfs dfs -mkdir ....
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