gpt4 book ai didi

hadoop - 无法将文件从本地文件系统复制到 cloudera 上的 hadoop/hdfs

转载 作者:行者123 更新时间:2023-12-02 21:07:27 25 4
gpt4 key购买 nike

在 fedora25 上安装 cloudera HDC 后,我可以创建文件夹,但不能创建文件,也不能将数据从本地文件系统复制到 HDFS。

这是我使用的命令:

sudo -u hdfs hadoop fs -copyFromLocal /home/mohammed/Documents/bbc.txt /kareem/corpora/

这是我从终端得到的:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
copyFromLocal: '/home/mohammed/Documents/bbc.txt': No such file or directory

如何克服这个问题?

非常感谢您的帮助!

最佳答案

问题是你的本地路径 /home/mohammed用户无法访问 hdfs您正在 sudo-ing 以运行整个命令。由于hdfs的本地linux用户无法进入 /home/mohammed ,该命令抛出 No such file or directory错误并由于无法定位或读取提供的文件而退出。

在大多数打包的 HDFS 安装中,hdfs user 通常是分布式文件系统的 super 用户,管理命令通常以该用户身份运行。但是,在使用 hdfs 后,可以而且应该以普通用户的身份对数据进行处理。 user 为普通用户提供权限和所有权。

对于您的情况,您可以执行以下操作 mohammed用户,如果此帐户也有 sudo 权限:

# Superuser-provisioning part (do once)

# Ensure the HDFS directory exists by creating it as a superuser
~> sudo -u hdfs hadoop fs -mkdir -p /kareem/corpora
# Ensure also the HDFS-home path exists by creating it as a superuser
~> sudo -u hdfs hadoop fs -mkdir -p /user/mohammed
# Grant ownership entirely to user mohammed for both paths
~> sudo -u hdfs hadoop fs -chown -R mohammed:mohammed /kareem /user/mohammed

# Final usage part (continue or repeat as many times) without superuser

# Upload the local file (note the absence of sudo)
~> hadoop fs -copyFromLocal -f /home/mohammed/Documents/bbc.txt /kareem/corpora/
# Now read it, etc., all done as the regular non-'hdfs' user
~> hadoop fs -text /home/mohammed/Documents/bbc.txt

关于hadoop - 无法将文件从本地文件系统复制到 cloudera 上的 hadoop/hdfs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41378334/

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