2016-12-29 119 views
0

上fedora25安裝Cloudera的HDC之後,我可以創建文件夾,而不是文件我也不能從我的本地文件系統HDFS複製數據。無法從本地文件系統中的文件複製到的Hadoop/HDFS上的Cloudera

這是命令我使用:

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 

如何解決這個問題?

你的幫助是高度讚賞!

+0

沒有'/家庭/穆罕默德/文檔/ bbc.txt'文件是否存在,並有機會獲得給hdfs用戶? – mrsrinivas

回答

0

問題是您的本地路徑/home/mohammed無法訪問,因爲您要運行整個命令的用戶是hdfs。由於hdfs本地Linux用戶無法進入/home/mohammed,命令拋出一個No such file or directory錯誤並退出其作爲生活在無法找到或閱讀提供的文件的結果。

在大多數打包的HDFS安裝中,hdfs用戶通常是分佈式文件系統的超級用戶,管理命令通常以該用戶的身份運行。但是,在使用hdfs用戶爲常規用戶設置權限和所有權後,可以並且應該以常規用戶的身份完成數據處理工作。

對於你的情況,你可以做以下爲您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 
相關問題