copyFromLocal
Usage: hadoop fs -copyFromLocal <localsrc> URI
Similar to put command, except that the source is restricted to a local file reference.
Options:
The -f option will overwrite the destination if it already exists.
mkdir
Usage: hadoop fs -mkdir [-p] <paths>
Takes path uri’s as argument and creates directories.
Options:
The -p option behavior is much like Unix mkdir -p, creating parent directories along the path.
Example:
hadoop fs -mkdir /user/hadoop/dir1 /user/hadoop/dir2
hadoop fs -mkdir hdfs://nn1.example.com/user/hadoop/dir hdfs://nn2.example.com/user/hadoop/dir
Exit Code:
Returns 0 on success and -1 on error.
2条答案
按热度按时间nbysray51#
hadoop文件系统(fs)shell包括各种类似shell的命令,这些命令直接与hadoop分布式文件系统(hdfs)以及hadoop支持的其他文件系统交互,例如本地fs、hftp fs、s3 fs(amazon)、azure blob(micorsoft azure blob)和其他文件系统。
参考hadoop命令指南有更多的信息,包括hadoop fs命令的细节,应该用来实现您的要求,其他可以在参考指南中看到。
to94eoyn2#
如果尝试将配置文件从本地文件系统复制到hdfs,请尝试以下操作:
1在hdfs中创建目录:
2将文件复制到hdfs:
更新1:
在/home/hadoopuser/.bashrc中导出hadoop命令(导出hdfs命令)