hdfs command

1:appendToFile追加文件至目标文件末尾。

  $>hadoop fs -appendToFile text111.txt /spaceQuota/text.txt

2:getmerge合并文件

   $>hadoop fs -getmerge -nl /spaceQuota textmerge.txt

3.setrep: 设置文件或目录的复本因子
  $>hadoop fs -setrep -w 1 /spaceQuota/text.txt

4:Snapshot快照

  $>hdfs dfsadmin -allowSnapshot /spaceQuota //文件夹spaceQuota可以做快照

  $>hdfs dfs -createSnapshot /spaceQuota snapshot1 //创建快照

  $>hdfs dfs -deleteSnapshot /spaceQuota snapshot1 //删除快照
  $>hdfs dfs -renameSnapshot /spaceQuota snapshot1 spaceQuota_snapshot
  $>hdfs lsSnapshottableDir //列出快照的列表

还有些命令和我们linux指令都是一样的,比如mkdir创建目录,hdfs下就是

  $>hadoop fs -mkidr /demo

上传文件命令:

  hadoop fs -put test.txt /  (上传test.txt文件到hdfs的根目录下)

原文地址:https://www.cnblogs.com/lyr999736/p/9160496.html