HDFS中的file与block块之间的对应关系举例

来源:互联网 发布:smtp tls 端口 编辑:程序博客网 时间:2024/06/08 04:06

linux中的jdk-6u24-linux-i586.bin是81M

[root@hadoop local]# du -sh *211M    hadoop60M     hadoop-1.1.2.tar.gz250M    jdk81M     jdk-6u24-linux-i586.bin8.0K    mydata4.0K    word2.txt4.0K    word.txt

将jdk-6u24-linux-i586.bin上传到HDFS中

[root@hadoop local]# hadoop fs -put jdk-6u24-linux-i586.bin  /

通过hadoop fsck查看HDFS中jdk-6u24-linux-i586.bin文件对应的block块以及block块的分布情况

[root@hadoop local]# hadoop fsck /jdk-6u24-linux-i586.bin   -files -blocks -locations -racksFSCK started by root from /192.168.80.100 for path /jdk-6u24-linux-i586.bin at Mon Oct 10 05:37:20 PDT 2016/jdk-6u24-linux-i586.bin 84927175 bytes, 2 block(s):  OK0. blk_-8238180044705517797_5753 len=67108864 repl=1 [/default-rack/192.168.80.100:50010]1. blk_136889878628398312_5753 len=17818311 repl=1 [/default-rack/192.168.80.100:50010]

我们到DataNode存放数据的目录下查看一下:

[root@hadoop current]# lltotal 83592-rw-r--r--. 1 root root 17818311 Oct 10 05:34 blk_136889878628398312-rw-r--r--. 1 root root   139215 Oct 10 05:34 blk_136889878628398312_5753.meta-rw-r--r--. 1 root root 67108864 Oct 10 05:34 blk_-8238180044705517797-rw-r--r--. 1 root root   524295 Oct 10 05:34 blk_-8238180044705517797_5753.meta

或者

[root@hadoop current]# du -sh *17M     blk_136889878628398312136K    blk_136889878628398312_5753.meta64M     blk_-8238180044705517797516K    blk_-8238180044705517797_5753.meta

通过查看,我们发现文件的存储和我们的预想是相同的,说明HDFS中的文件归根到底是要存储到Linux文件系统中的。

原创粉丝点击