gpt4 book ai didi

hadoop - Hadoop/HDFS:put命令失败-没有这样的文件或目录

转载 作者:行者123 更新时间:2023-12-02 19:52:50 25 4
gpt4 key购买 nike

我不知道为什么无法将文件从一个目录移动到另一个目录。我可以查看文件的内容,但是不能将同一文件移动到另一个目录。
工作正常:hadoop fs -cat /user/hadoopusr/project-data.txt不起作用:hadoop fs -put /user/hadoopusr/project-data.txt /user/hadoopusr/Projects/MarketAnalysis我收到了No such file or directory错误消息。怎么了?请帮忙。谢谢!

最佳答案

正如我们可以从here中阅读的有关-put命令的内容:

This command is used to copy files from the local file system to theHDFS filesystem. This command is similar to –copyFromLocal command.This command will not work if the file already exists unless the –fflag is given to the command. This overwrites the destination if thefile already exists before the copy


这清楚说明了为什么它不起作用并引发 No such file or directory消息。这是因为它在本地文件系统的当前目录中找不到名称为 project-data.txt的任何文件。
您计划在HDFS内的目录之间移动文件,因此,与在本地文件系统中一样,我们可以简单地使用 -put参数来代替使用 -mv参数!
在我自己的HDFS上进行了如下测试:
  • 在HDFS中创建源目录和目标目录
  • hadoop fs -mkdir source_dir dest_dir
  • 在源目录
  • 下创建一个空文件(出于测试目的)
    hadoop fs -touch source_dir/test.txt
  • 将空文件移到目标目录
  • hadoop fs -mv source_dir/test.txt dest_dir/test.txt(请注意,不需要文件路径和目标目录的 /user/username/部分,因为默认情况下,您正在工作的目录上是HDFS。您还应注意,必须使用以下命令写入目标 的完整路径:文件名包括。)
    您可以在下面的HDFS浏览器中看到空文本文件已移动到目标目录:
    enter image description here

    关于hadoop - Hadoop/HDFS:put命令失败-没有这样的文件或目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64597083/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com