Hadoop是否将本地文件复制到HDFS? [英] Hadoop copying local file to HDFS?
问题描述
我正在尝试将名为"afile"的本地文件复制到HDFS.所以我运行了以下命令:
I'm trying to copy a local file called 'afile' to the HDFS. So I ran the following command:
'hadoop fs -copyFromLocal/home/neo/afile in'或"hadoop fs -put/home/neo/afile in"
'hadoop fs -copyFromLocal /home/neo/afile in' or 'hadoop fs -put /home/neo/afile in'
但是,它说:文件/home/neo/afile不存在"
However, it says: 'File /home/neo/afile does not exist'
然后,我将文件"afile"放入hadoop下的目录中.现在,copyFromLocal成功.但是,文件"in"为空,因为我运行了显示"hadoop fs-ls"
Then I put the file 'afile' into the directory under hadoop. Now the copyFromLocal succeeded. However, the file 'in' is empty, since I run 'hadoop fs - ls', it shows
'-rw-r--r--'1 neo supergroup 0 2015-04-06 17:45/user/neo/in
'-rw-r--r--' 1 neo supergroup 0 2015-04-06 17:45 /user/neo/in
我也尝试过'hadoop fs -cat in',什么也没返回.
I also tried 'hadoop fs -cat in', nothing returned.
有人可以帮忙吗?
谢谢!
推荐答案
-
在
/home/neo/
向 test.txt
添加内容:回显"wordcount的示例文本">/home/neo/test.txt
使用以下命令在hdfs中创建新目录:hadoop fs -mkdir/user/neo/in/
Create a new directory in hdfs using: hadoop fs -mkdir /user/neo/in/
将文件从本地目录复制到HDFS: hadoop fs -copyFromLocal/home/neo/test.txt/user/neo/in/test.txt
Copy file from local directory to HDFS: hadoop fs -copyFromLocal /home/neo/test.txt /user/neo/in/test.txt
这篇关于Hadoop是否将本地文件复制到HDFS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!