【大資料】【hadoop】檢視hdfs檔案命令

kyle0349發表於2020-11-29

檢視hdfs檔案的blockSize

# 檢視檔案的blockSize
[root@cdh01 text]# hdfs dfs -stat "%n %b %o %r %y %F" /tmp/example/access_2013_05_31.log
access_2013_05_31.log 157069653 134217728 3 2020-10-07 02:05:07 regular file
[root@cdh01 text]# hadoop fs  -stat "%n %b %o %r %y %F" /tmp/example/access_2013_05_31.log
access_2013_05_31.log 157069653 134217728 3 2020-10-07 02:05:07 regular file

%b:列印檔案大小(目錄為0)
%n:列印檔名
%o:列印block size
%r:列印備份數
%y:列印UTC日期 yyyy-MM-dd HH:mm:ss
%Y:列印自1970年1月1日以來的UTC微秒數
%F:目錄列印directory, 檔案列印regular file

檢視hdfs檔案,block的詳細資訊(檔案的健康狀況)

[root@cdh01 text]# hdfs fsck hdfs://cdh01/tmp/example/access_2013_05_31.log
Connecting to namenode via http://cdh01:9870/fsck?ugi=root&path=%2Ftmp%2Fexample%2Faccess_2013_05_31.log
FSCK started by root (auth:SIMPLE) from /192.168.2.101 for path /tmp/example/access_2013_05_31.log at Sun Oct 18 22:13:54 CST 2020

Status: HEALTHY
 Number of data-nodes:	3
 Number of racks:		1
 Total dirs:			0
 Total symlinks:		0

Replicated Blocks:
 Total size:	157069653 B
 Total files:	1
 Total blocks (validated):	2 (avg. block size 78534826 B)
 Minimally replicated blocks:	2 (100.0 %)
 Over-replicated blocks:	0 (0.0 %)
 Under-replicated blocks:	0 (0.0 %)
 Mis-replicated blocks:		0 (0.0 %)
 Default replication factor:	3
 Average block replication:	3.0
 Missing blocks:		0
 Corrupt blocks:		0
 Missing replicas:		0 (0.0 %)
 Blocks queued for replication:	0

Erasure Coded Block Groups:
 Total size:	0 B
 Total files:	0
 Total block groups (validated):	0
 Minimally erasure-coded block groups:	0
 Over-erasure-coded block groups:	0
 Under-erasure-coded block groups:	0
 Unsatisfactory placement block groups:	0
 Average block group size:	0.0
 Missing block groups:		0
 Corrupt block groups:		0
 Missing internal blocks:	0
 Blocks queued for replication:	0
FSCK ended at Sun Oct 18 22:13:54 CST 2020 in 1 milliseconds


The filesystem under path '/tmp/example/access_2013_05_31.log' is HEALTHY

相關文章