What is difference between put and copyfromlocal
Greeting everyone you will be looking around what are the difference between put and copyfromlocal. hadoopquiz present here a clear difference
Many of us usually get confuse while specifying difference between put and copyfromlocal.
Below table clearly specifies about this difference hope this will be usefull for you.
more differences related to hadoop ecosystem can be find @ Difference Zone
put
|
copyFromLocal
| |
Usage
| ||
Functionality 1
| ||
Functionality 2
| ||
File Copying Specification
| Multiple file copy : hadoopfs -put localfile1 localfile2 /user/hadoop/hddir | |
Stdin Support
|
Source Code for the same from Hadoop trunk
class CopyCommands {
public static void registerCommands(CommandFactory factory) {
factory.addClass(Merge.class, "-getmerge");
factory.addClass(Cp.class, "-cp");
factory.addClass(CopyFromLocal.class, "-copyFromLocal");
factory.addClass(CopyToLocal.class, "-copyToLocal");
factory.addClass(Get.class, "-get");
factory.addClass(Put.class, "-put");
}
public static class Put extends CommandWithDestination {
public static final String NAME = "put";
public static final String USAGE = "<localsrc> ... <dst>";
public static final String DESCRIPTION =
"Copy files from the local file system\n" +
"into fs.";
...
}
public static class CopyFromLocal extends Put {
public static final String NAME = "copyFromLocal";
public static final String USAGE = Put.USAGE;
public static final String DESCRIPTION = "Identical to the -put command.";
}
}
a good reply related to difference between put and copyfromlocal is mentioned over stackoverflow.
Let's make an example: If your HDFS contains the path: /tmp/dir/abc.txt
And if your local disk also contains this path then the hdfs API won't know which one you mean, unless you specify a scheme like file:// or hdfs://.
Maybe it picks the path you did not want to copy.
Therefore you have -copyFromLocal which is preventing you from accidentally copying the wrong file, by limiting the parameter you give to the local filesystem.
Put is for more advanced users who know which scheme to put in front.
It is always a bit confusing to new Hadoop users which filesystem they are currently in and where their files actually are.
Let's make an example: If your HDFS contains the path: /tmp/dir/abc.txt
And if your local disk also contains this path then the hdfs API won't know which one you mean, unless you specify a scheme like file:// or hdfs://.
Maybe it picks the path you did not want to copy.
Therefore you have -copyFromLocal which is preventing you from accidentally copying the wrong file, by limiting the parameter you give to the local filesystem.
Put is for more advanced users who know which scheme to put in front.
It is always a bit confusing to new Hadoop users which filesystem they are currently in and where their files actually are.
Sr No
|
Difference Index
|
Link
|
1
| What is difference between Operational vs. Analytical Systems | |
2
| What is difference between RDBMS vs Hive | |
3
| What is difference between RDBMS vs Hive vs Impala |
if you want to add few many things please do comment in comment section.
Post a Comment
image video quote pre code