hadoop(十)hdfs上传删除文件(完全分布式七)|12

集群测试

上传小文件到集群,随便选择一个小文件上传到hdfs的根目录

[shaozhiqi@hadoop102 hadoop-3.1.2]$ bin/hdfs dfs -put wcinput/wc.input /
[shaozhiqi@hadoop102 hadoop-3.1.2]$

验证是否上传成功,验证ok,Replication的3代表三个副本数

image.png
image.png


上传一个大文件如我们的hadoop安装包

 

[shaozhiqi@hadoop102 hadoop-3.1.2]$ bin/hdfs dfs -put /opt/software/hadoop-3.1.2.tar.gz /
image.png
image.png

 

查看每个文件在hdfs的副本情况和存储块block,默认每个block大小为128M
关于块block的说明:当hdfs上收到的文件大于128M,则该文件会被切分存储为多个块,多个块以块为单位存储在不用的datanode上。但是值的注意的是如果某个文件大小没有达到128M,则按文件大小存储,不会占用整个128M的空间。

点击:Wc.Input

image.png
image.png


点击Hadoop-3.1.2.tar.gz

image.png
image.png


每个block最大存储128M,多出就会再多一个block去存储

 

文件在hdfs的实际路劲

[shaozhiqi@hadoop102 subdir0]$ ll
total 327200
-rw-rw-r--. 1 shaozhiqi shaozhiqi 50 Jun 27 21:18 blk_1073741825 -rw-rw-r--. 1 shaozhiqi shaozhiqi 11 Jun 27 21:18 blk_1073741825_1001.meta -rw-rw-r--. 1 shaozhiqi shaozhiqi 134217728 Jun 27 21:25 blk_1073741826 -rw-rw-r--. 1 shaozhiqi shaozhiqi 1048583 Jun 27 21:25 blk_1073741826_1002.meta -rw-rw-r--. 1 shaozhiqi shaozhiqi 134217728 Jun 27 21:26 blk_1073741827 -rw-rw-r--. 1 shaozhiqi shaozhiqi 1048583 Jun 27 21:26 blk_1073741827_1003.meta -rw-rw-r--. 1 shaozhiqi shaozhiqi 63998133 Jun 27 21:26 blk_1073741828 -rw-rw-r--. 1 shaozhiqi shaozhiqi 499995 Jun 27 21:26 blk_1073741828_1004.meta [shaozhiqi@hadoop102 subdir0]$ pwd /opt/module/hadoop-3.1.2/data/tmp/dfs/data/current/BP-1884196904-192.168.1.102-1561640654781/current/finalized/subdir0/subdir0 [shaozhiqi@hadoop102 subdir0]$ cat blk_1073741825 #可以确定整个就是我们的wc.input hadoop yarn hadoop mapreduce shaozhiqi shaozhiqi [shaozhiqi@hadoop102 subdir0]$ 

删除我们刚刚上传到hdfs的文件

[shaozhiqi@hadoop102 hadoop-3.1.2]$ bin/hdfs dfs -rm -r /wc.input
Deleted /wc.input
[shaozhiqi@hadoop102 hadoop-3.1.2]$ bin/hdfs dfs -rm -r /hadoop-3.1.2.tar.gz Deleted /hadoop-3.1.2.tar.gz [shaozhiqi@hadoop102 hadoop-3.1.2]$ 

验证是否删除,验证ok

image.png
image.png

转载于:https://www.cnblogs.com/shaozhiqi/p/11534851.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值