大数据最新Hadoop大数据应用:HDFS 集群节点缩容(1),2024年最新2024年大数据开发开发陷入饱和

img
img

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化资料的朋友,可以戳这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!


一、实验

1.环境

(1)主机

表1  主机

主机架构软件版本IP备注
hadoopNameNode (已部署) SecondaryNameNode (已部署) ResourceManager(已部署)hadoop2.7.7192.168.204.50
node01DataNode(已部署) NodeManager(已部署)hadoop2.7.7192.168.204.51
node02DataNode(已部署) NodeManager(已部署)hadoop2.7.7192.168.204.52
node03DataNode(已部署) NodeManager(已部署)hadoop2.7.7192.168.204.53
node04DataNode(已部署)hadoop2.7.7192.168.204.54需求迁移主机

(2)查看jps

hadoop节点

[root@hadoop ~]# jps

node01节点

node02节点

node03节点

node04节点

2.HDFS 集群节点缩容

(1)查看节点状态 (已使用)

node01: 176KB (约等于0.18M )

node02: 280KB  (约等于0.28M )

node03: 260KB  (约等于0.26M )

node04:  8KB (约等于0.008M)

[root@hadoop hadoop]# ./bin/hdfs dfsadmin -report
Configured Capacity: 822126559232 (765.67 GB)
Present Capacity: 798788423680 (743.93 GB)
DFS Remaining: 798787682304 (743.93 GB)
DFS Used: 741376 (724 KB)
DFS Used%: 0.00%
Under replicated blocks: 0
Blocks with corrupt replicas: 0
Missing blocks: 0
Missing blocks (with replication factor 1): 0

-------------------------------------------------
Live datanodes (4):

Name: 192.168.204.54:50010 (node04)
Hostname: node04
Decommission Status : Normal
Configured Capacity: 205531639808 (191.42 GB)
DFS Used: 8192 (8 KB)
Non DFS Used: 5658730496 (5.27 GB)
DFS Remaining: 199872901120 (186.15 GB)
DFS Used%: 0.00%
DFS Remaining%: 97.25%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Xceivers: 1
Last contact: Thu Mar 14 15:16:33 CST 2024


Name: 192.168.204.53:50010 (node03)
Hostname: node03
Decommission Status : Normal
Configured Capacity: 205531639808 (191.42 GB)
DFS Used: 266240 (260 KB)
Non DFS Used: 5620936704 (5.23 GB)
DFS Remaining: 199910436864 (186.18 GB)
DFS Used%: 0.00%
DFS Remaining%: 97.27%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Xceivers: 1
Last contact: Thu Mar 14 15:16:33 CST 2024


Name: 192.168.204.51:50010 (node01)
Hostname: node01
Decommission Status : Normal
Configured Capacity: 205531639808 (191.42 GB)
DFS Used: 180224 (176 KB)
Non DFS Used: 6029176832 (5.62 GB)
DFS Remaining: 199502282752 (185.80 GB)
DFS Used%: 0.00%
DFS Remaining%: 97.07%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Xceivers: 1
Last contact: Thu Mar 14 15:16:34 CST 2024


Name: 192.168.204.52:50010 (node02)
Hostname: node02
Decommission Status : Normal
Configured Capacity: 205531639808 (191.42 GB)
DFS Used: 286720 (280 KB)
Non DFS Used: 6029291520 (5.62 GB)
DFS Remaining: 199502061568 (185.80 GB)
DFS Used%: 0.00%
DFS Remaining%: 97.07%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Xceivers: 1
Last contact: Thu Mar 14 15:16:34 CST 2024

(2)查看

[root@hadoop ~]# cd /usr/local/hadoop/
[root@hadoop hadoop]# ./bin/hadoop fs -ls /

(3)上传第一个测试文件

[root@hadoop ~]# /usr/local/hadoop/bin/hadoop fs -put /root/jenkins.tar.gz /jenkins.tar.gz

观察上传变化

[root@hadoop hadoop]# ./bin/hadoop fs -ls /

(4)上传第二个测试文件

[root@hadoop ~]# /usr/local/hadoop/bin/hadoop fs -put /root/pinpoint-image.tar.gz /pinpoint.tar.gz

观察上传变化

[root@hadoop hadoop]# ./bin/hadoop fs -ls /

(5)web查看

http://192.168.204.50:50070/

(6)清空本地文件

[root@hadoop ~]# rm -rf jenkins.tar.gz pinpoint-image.tar.gz

(7)再次查看节点状态 (已使用)

node01: 2.41GB

node02: 2.27GB

node03: 2.15GB

node04:  2.26GB

[root@hadoop hadoop]#  ./bin/hdfs dfsadmin -report
Configured Capacity: 822126559232 (765.67 GB)
Present Capacity: 798784053248 (743.93 GB)
DFS Remaining: 789019389952 (734.83 GB)
DFS Used: 9764663296 (9.09 GB)
DFS Used%: 1.22%
Under replicated blocks: 0
Blocks with corrupt replicas: 0
Missing blocks: 0
Missing blocks (with replication factor 1): 0

-------------------------------------------------
Live datanodes (4):

Name: 192.168.204.54:50010 (node04)
Hostname: node04
Decommission Status : Normal
Configured Capacity: 205531639808 (191.42 GB)
DFS Used: 2424492032 (2.26 GB)
Non DFS Used: 5662638080 (5.27 GB)
DFS Remaining: 197444509696 (183.88 GB)
DFS Used%: 1.18%
DFS Remaining%: 96.07%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Xceivers: 1
Last contact: Thu Mar 14 15:57:57 CST 2024


Name: 192.168.204.53:50010 (node03)
Hostname: node03
Decommission Status : Normal
Configured Capacity: 205531639808 (191.42 GB)
DFS Used: 2312085504 (2.15 GB)
Non DFS Used: 5620936704 (5.23 GB)
DFS Remaining: 197598617600 (184.03 GB)
DFS Used%: 1.12%
DFS Remaining%: 96.14%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Xceivers: 1
Last contact: Thu Mar 14 15:57:58 CST 2024


Name: 192.168.204.51:50010 (node01)
Hostname: node01
Decommission Status : Normal
Configured Capacity: 205531639808 (191.42 GB)
DFS Used: 2592927744 (2.41 GB)
Non DFS Used: 6029148160 (5.62 GB)
DFS Remaining: 196909563904 (183.39 GB)
DFS Used%: 1.26%
DFS Remaining%: 95.80%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Xceivers: 1
Last contact: Thu Mar 14 15:57:57 CST 2024


Name: 192.168.204.52:50010 (node02)
Hostname: node02
Decommission Status : Normal
Configured Capacity: 205531639808 (191.42 GB)
DFS Used: 2435158016 (2.27 GB)
Non DFS Used: 6029783040 (5.62 GB)
DFS Remaining: 197066698752 (183.53 GB)
DFS Used%: 1.18%
DFS Remaining%: 95.88%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Xceivers: 1
Last contact: Thu Mar 14 15:57:59 CST 2024

(8)计算总存储使用量

9.09 G (jenkins 1.24 GB,pinpoint 3.27 GB ,存储副本量为2)

(9)修改配置文件(hadoop节点)

#添加代码

[root@hadoop hadoop]# vim hdfs-site.xml

修改前:

修改后:

……
      <property>
          <name>dfs.hosts.exclude</name>
          <value>/usr/local/hadoop/etc/hadoop/exclude</value>
      </property>
……

(10)配置移除主机

[root@hadoop hadoop]# vim /usr/local/hadoop/etc/hadoop/exclude

node04

(11)数据刷新

[root@hadoop hadoop]# ./bin/hdfs dfsadmin -refreshNodes

(12)查看节点状态

node04节点状态变为Decommissioned in Program

[root@hadoop hadoop]#  ./bin/hdfs dfsadmin -report
Configured Capacity: 619019411456 (576.51 GB)
Present Capacity: 600866701319 (559.60 GB)
DFS Remaining: 590966771712 (550.38 GB)
DFS Used: 9899929607 (9.22 GB)
DFS Used%: 1.65%
Under replicated blocks: 2
Blocks with corrupt replicas: 0
Missing blocks: 0
Missing blocks (with replication factor 1): 0

-------------------------------------------------
Live datanodes (4):

Name: 192.168.204.54:50010 (node04)
Hostname: node04
Decommission Status : Decommission in progress
Configured Capacity: 205531639808 (191.42 GB)
DFS Used: 2424492032 (2.26 GB)
Non DFS Used: 5663162368 (5.27 GB)
DFS Remaining: 197443985408 (183.88 GB)
DFS Used%: 1.18%
DFS Remaining%: 96.06%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Xceivers: 1
Last contact: Thu Mar 14 16:34:33 CST 2024


Name: 192.168.204.53:50010 (node03)
Hostname: node03
Decommission Status : Normal
Configured Capacity: 205531639808 (191.42 GB)
DFS Used: 2312085504 (2.15 GB)
Non DFS Used: 5756112896 (5.36 GB)
DFS Remaining: 197463441408 (183.90 GB)
DFS Used%: 1.12%
DFS Remaining%: 96.07%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Xceivers: 2
Last contact: Thu Mar 14 16:34:31 CST 2024


Name: 192.168.204.51:50010 (node01)
Hostname: node01
Decommission Status : Normal
Configured Capacity: 205531639808 (191.42 GB)
DFS Used: 2592927744 (2.41 GB)
Non DFS Used: 6232051712 (5.80 GB)
DFS Remaining: 196706660352 (183.20 GB)
DFS Used%: 1.26%
DFS Remaining%: 95.71%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Xceivers: 3
Last contact: Thu Mar 14 16:34:33 CST 2024


Name: 192.168.204.52:50010 (node02)
Hostname: node02
Decommission Status : Normal
Configured Capacity: 205531639808 (191.42 GB)
DFS Used: 2570424327 (2.39 GB)
Non DFS Used: 6164545529 (5.74 GB)
DFS Remaining: 196796669952 (183.28 GB)
DFS Used%: 1.25%
DFS Remaining%: 95.75%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Xceivers: 2
Last contact: Thu Mar 14 16:34:32 CST 2024


Decommissioning datanodes (1):



![img](https://img-blog.csdnimg.cn/img_convert/0232dbb9128168068a1ac2376673151b.png)
![img](https://img-blog.csdnimg.cn/img_convert/585479f1df9ee6e71cb75771e8ba2798.png)

**网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。**

**[需要这份系统化资料的朋友,可以戳这里获取](https://bbs.csdn.net/forums/4f45ff00ff254613a03fab5e56a57acb)**


**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**

onfigured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Xceivers: 2
Last contact: Thu Mar 14 16:34:32 CST 2024


Decommissioning datanodes (1):



[外链图片转存中...(img-N74Jn7gu-1715437893054)]
[外链图片转存中...(img-jijAA9NX-1715437893054)]

**网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。**

**[需要这份系统化资料的朋友,可以戳这里获取](https://bbs.csdn.net/forums/4f45ff00ff254613a03fab5e56a57acb)**


**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**

  • 10
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值