HDFS 处理命令记录

hdfs dfs -ls
hdfs dfs -mkdir
hdfs dfs -put
hdfs dfs -get 
hdfs dfs -cat 

hadoop 执行jar  输出的目录 必须要不存在的

yarn jar dpi-hadoop-1.0.0.jar MapReduceJob /test/lilin/input /test/lilin/out/dpi
 
查看目录大小
hdfs fsck /test/dpi/dpi_out/2016120715
 
获取.lzo_deflate的文件内容   
hdfs dfs -text /daas/bstl/dpifix/beijing/20170315/FixedDPI.2017031523_99.1489593029667.lzo_deflate > test.txt
 
特别注意:文件中包含不可见字符最好用vi命令来查看文件内容。
 
lzo_deflate  处理方式 记录:

查看hdfs的压缩文件 重定向 到本地文件

hdfs dfs -text /test/20170315/FixedDPI.2017031523_99.1489593029667.lzo_deflate  > test.txt

取文件的前多少行 到另外的文件

head -n 1000 test.txt > test1.txt

压缩文件小文件:

gzip  test1.txt

获取小文件:压缩后的文件

sz -e test1.txt.gz

解压缩文件

gunzip test1.txt.gz

上传到HDFS

hdfs dfs -put test1.txt /HDFS文件路径
 
 
 
 
 
 
 
原文地址:https://www.cnblogs.com/lilin0719/p/6798700.html