我试图复制一个文件从源到hdfs
查询:hadoop fs-copyfromlocal(本地路径)(源路径)
e、 g hadoop fs-copyfromlocal c:\users\desktop(源路径)
例如hadoop fs-copyfromlocal c:\users\desktop uri
但是得到错误
-copyfromlocal:无法从空字符串创建路径用法:hadoop fs[generic options]-copyfromlocal[-f][-p](localsrc)((夏时制)
4条答案
按热度按时间6qfn3psc1#
您没有指定文件的路径。
确保指定的hdfs路径存在。
最后试着避开正斜杠,比如:
或使用
rn0zuynd2#
hdfs和其他文件系统一样。路径以/作为根开始。句点(.)表示当前目录。我在linux平台上。希望下面的例子能有所帮助。
mec1mxoz3#
很遗憾,我无法在你的回复下面发表评论。获取路径的最简单方法是在ui下面单击“browsethefilesystem”。另一个选择是
hdfs dfs -ls /
或者hdfs dfs -lsr /
ls
将列出根目录中的目录/文件。lsr
将递归地读取根目录中的所有子目录。yyhrrdl84#
尝试
hadoop dfs -copyFromLocal file_to_be_copied hdfs://namenode:/path_to_location
fs命令正在折旧。注意:您不必提及实际的hdfs路径。你也可以这样做
hadoop dfs -copyFromLocal file_to_be_copied /path_to_location_within_hdfs