Hadoop中-put和-copyFromLocal的區別
如下中的stackoverflow的連結。
簡單的說,-put更寬鬆,可以把本地或者HDFS上的檔案拷貝到HDFS中;而-copyFromLocal則更嚴格限制只能拷貝本地檔案到HDFS中。
???
PS:“ put would prefer the HDFS scheme instead of the local file system”,也就是說,如果本地和HDFS上都存在相同路徑,則-put跟趨於優先取HDFS的源。
但是我測試了:
hadoop fs -put hdfs:///tmp/hive-XXX/test.txt /user/XXX/test.txt.hdfs
hadoop fs -put /tmp/hive-XXX/test.txt /user/XXX/test.txt.local
hadoop fs -cat /user/XXX/test.txt.*
local path:/tmp/hive-XXX
local path:/tmp/hive-XXX
所以。。。。
連結:http://stackoverflow.com/questions/7811284/difference-between-hadoop-fs-put-and-hadoop-fs-copyfromlocal
——————————————————————————————————————————————
Same thing for |
So, basically you can do with put, all that you do with copyFromLocal, but not vice-versa. Similarly,
Hence, you can use get instead of copyToLocal, but not the other way round. |
Let's make an example: If your HDFS contains the path:
Therefore you have
It is always a bit confusing to new Hadoop users which filesystem they are currently in and where their files actually are. |
|||||||||
|