异常信息
1/1 local-dirs usable space is below configured utilization percentage/no more usable space [ /data/hadoop/tmp/data/nm-local-dir : used space above threshold of 90.0% ] ; 1/1 log-dirs usable space is below configured utilization percentage/no more usable space [ /data/hadoop/logs/userlogs : used space above threshold of 90.0% ]
由Hadoop的web管理端可以看到是因为磁盘使用率超过90%,产生的不健康节点
查看hdfs管理控制台看到node3的存储使用了42%,
进入node3节点,使用df -h查看磁盘使用情况,发现hdfs-site.xml配置的dfs.datanode.data.dir的一个目录磁盘确实使用达到90%
解决办法:
第一步
使用命令:hdfs diskbalancer -plan 节点名称
我是node3节点需要平衡,所以我使用:hdfs diskbalancer -plan node3
命令执行完毕以后会生成一个xxxx/节点名称.plan.json的文件
[bigdata@master ~]$ hdfs diskbalancer -plan node3
2020-10-19 18:07:40,599 INFO planner.GreedyPlanner: Starting plan for Node : node3:9867
2020-10-19 18:07:40,601 INFO planner.GreedyPlanner: Disk Volume set fa9cbf3c-61f4-434f-be30-7a9736922c32 Type : DISK plan completed.
2020-10-19 18:07:40,602 INFO planner.GreedyPlanner: Compute Plan for Node : node3:9867 took 20 ms
2020-10-19 18:07:40,602 INFO command.Command: Writing plan to:
2020-10-19 18:07:40,602 INFO command.Command: /system/diskbalancer/2020-十月-19-18-07-40/node3.plan.json
Writing plan to:
/system/diskbalancer/2020-十月-19-18-07-40/node3.plan.json
第二步:
根据第一步生成的json文件,我生成的json名称为:/system/diskbalancer/2020-十月-19-18-07-40/node3.plan.json
执行命令:hdfs diskbalancer -execute xxxx.json
根据我生成文件,所以我执行的命令是: hdfs diskbalancer -execute /system/diskbalancer/2020-十月-19-18-07-40/node3.plan.json
[bigdata@master ~]$ hdfs diskbalancer -execute /system/diskbalancer/2020-十月-19-18-07-40/node3.plan.json
2020-10-19 18:08:03,451 INFO command.Command: Executing "execute plan" command
第三步查询执行结果
执行命令:hdfs diskbalancer -query 节点名称
我平衡的是node3,所以我的命令是:hdfs diskbalancer -query node3
看到PLAN_UNDER_PROGRESS 表示正在平衡,
PLAN_DONE 表示完成
[bigdata@master ~]$ hdfs diskbalancer -query node3
2020-10-19 18:08:45,869 INFO command.Command: Executing "query plan" command.
Plan File: /system/diskbalancer/2020-十月-19-18-07-40/node3.plan.json
Plan ID: 4bebf9380c5209f7909cd2e978ea591193ee398c
Result: PLAN_UNDER_PROGRESS