hadoop put 命令中的目标已存在错误

发布于 2025-01-07 11:43:18 字数 1656 浏览 5 评论 0原文

我正在尝试 Hadoop 1.0。将一个文件从本地系统复制到 HDFS 时,我收到目标不存在

我的hadoop命令及其输出如下:

shekhar@ubuntu:/host/Shekhar/Softwares/hadoop-1.0.0/bin$ hadoop dfs -put /host/Users/Shekhar/Desktop/Downloads/201112/20111201.txt .
Warning: $HADOOP_HOME is deprecated.

put: Target  already exists

观察输出后,我们可以看到“Target”和“already”之间有两个空格。我认为这两个单词之间必须有类似 /user/${user} 的内容。如果我将目标路径明确指定为 /user/shekhar ,则会收到以下错误:

shekhar@ubuntu:/host/Shekhar/Softwares/hadoop-1.0.0/bin$ hadoop dfs -put /host/Users/Shekhar/Desktop/Downloads/201112/20111201.txt /user/shekhar/data.txt
Warning: $HADOOP_HOME is deprecated.

put: java.io.FileNotFoundException: Parent path is not a directory: /user/shekhar

ls 命令的输出如下:

shekhar@ubuntu:/host/Shekhar/Softwares/hadoop-1.0.0/bin$ hadoop dfs -lsr /
Warning: $HADOOP_HOME is deprecated.

drwxr-xr-x   - shekhar supergroup          0 2012-02-21 19:56 /tmp
drwxr-xr-x   - shekhar supergroup          0 2012-02-21 19:56 /tmp/hadoop-shekhar
drwxr-xr-x   - shekhar supergroup          0 2012-02-21 19:56 /tmp/hadoop-shekhar/mapred
drwx------   - shekhar supergroup          0 2012-02-21 19:56 /tmp/hadoop-shekhar/mapred/system
-rw-------   1 shekhar supergroup          4 2012-02-21 19:56 /tmp/hadoop-shekhar/mapred/system/jobtracker.info
drwxr-xr-x   - shekhar supergroup          0 2012-02-21 19:56 /user
-rw-r--r--   1 shekhar supergroup    6541526 2012-02-21 19:56 /user/shekhar

请帮助我将文件复制到 HDFS 中。如果您需要任何其他信息,请告诉我。

我正在 Ubuntu 中尝试这个,它是使用 WUBI (Windows Installer for ubuntu) 安装的。

提前致谢 !

I am trying my hands on Hadoop 1.0. I am getting Target does not exists while copying one file from local system into HDFS.

My hadoop command and its output is as follows :

shekhar@ubuntu:/host/Shekhar/Softwares/hadoop-1.0.0/bin$ hadoop dfs -put /host/Users/Shekhar/Desktop/Downloads/201112/20111201.txt .
Warning: $HADOOP_HOME is deprecated.

put: Target  already exists

After observing the output, we can see that there are two blank spaces between word 'Target' and 'already'. I think there has to be something like /user/${user} between those 2 words. If I give destination path explicitly as /user/shekhar then I get following error :

shekhar@ubuntu:/host/Shekhar/Softwares/hadoop-1.0.0/bin$ hadoop dfs -put /host/Users/Shekhar/Desktop/Downloads/201112/20111201.txt /user/shekhar/data.txt
Warning: $HADOOP_HOME is deprecated.

put: java.io.FileNotFoundException: Parent path is not a directory: /user/shekhar

Output of ls command is as follows :

shekhar@ubuntu:/host/Shekhar/Softwares/hadoop-1.0.0/bin$ hadoop dfs -lsr /
Warning: $HADOOP_HOME is deprecated.

drwxr-xr-x   - shekhar supergroup          0 2012-02-21 19:56 /tmp
drwxr-xr-x   - shekhar supergroup          0 2012-02-21 19:56 /tmp/hadoop-shekhar
drwxr-xr-x   - shekhar supergroup          0 2012-02-21 19:56 /tmp/hadoop-shekhar/mapred
drwx------   - shekhar supergroup          0 2012-02-21 19:56 /tmp/hadoop-shekhar/mapred/system
-rw-------   1 shekhar supergroup          4 2012-02-21 19:56 /tmp/hadoop-shekhar/mapred/system/jobtracker.info
drwxr-xr-x   - shekhar supergroup          0 2012-02-21 19:56 /user
-rw-r--r--   1 shekhar supergroup    6541526 2012-02-21 19:56 /user/shekhar

Please help me in copying file into HDFS. If you need any other information then please let me know.

I am trying this in Ubuntu which is installed using WUBI (Windows Installer for ubuntu).

Thanks in Advance !

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

幻梦 2025-01-14 11:43:18

put 命令中的问题是尾随 .。您需要指定 HDFS 上文件所在的完整路径,例如:

hadoop fs -put /host/Users/Shekhar/Desktop/Downloads/201112/20111201.txt /whatever/20111201.txt

如果您要放置文件的目录尚不存在,则需要先创建它:

hadoop fs -mkdir /whatever

当您明确指定路径时遇到的问题是,在您的系统上, /user/shekar 是一个文件,而不是目录。您可以看到这一点,因为它的大小非 0。

The problem in the put command is the trailing .. You need to specify the full path on HDFS where you want the file to go, for ex:

hadoop fs -put /host/Users/Shekhar/Desktop/Downloads/201112/20111201.txt /whatever/20111201.txt

If the directory that you are putting the file in doesn't exist yet, you need to create it first:

hadoop fs -mkdir /whatever

The problem that you are having when you specify the path explicitly is that on your system, /user/shekar is a file, not a directory. You can see that because it has a non-0 size.

杀お生予夺 2025-01-14 11:43:18

-rw-r--r-- 1 shekhar 超组 6541526 2012-02-21 19:56 /user/shekhar

shekhar@ubuntu:/host/Shekhar/Softwares/hadoop-1.0.0/bin $ hadoop dfs -put /host/Users/Shekhar/Desktop/Downloads/201112/20111201.txt /user/shekhar/data.txt

-rw-r--r-- 1 shekhar supergroup 6541526 2012-02-21 19:56 /user/shekhar

shekhar@ubuntu:/host/Shekhar/Softwares/hadoop-1.0.0/bin$ hadoop dfs -put /host/Users/Shekhar/Desktop/Downloads/201112/20111201.txt /user/shekhar/data.txt

美人骨 2025-01-14 11:43:18

你必须先制作文件!

hdfs dfs -mkdir /用户/hadoop
hdfs dfs -put /home/bigdata/.password /user/hadoop/

you must make the file first!

hdfs dfs -mkdir /user/hadoop
hdfs dfs -put /home/bigdata/.password /user/hadoop/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文