hadoop—dataproc工作节点的磁盘利用率日益提高

dvtswwa3  于 2021-05-27  发布在  Hadoop
关注(0)|答案(3)|浏览(485)

我们有一个主节点和7个工作节点的dataproc集群。所有工作节点都有一个引导磁盘和一个375 gb(sdb)的本地磁盘。工作节点0、1、2、3的sdb(mounted on/mnt/1)磁盘利用率已达到85%以上,5、6、7的磁盘利用率也逐渐提高到85%。
我们发现下面目录下的文件占了主要部分(304g)
/mnt/1/hadoop/dfs/data/current/bp-x-xx.xx.x-x/current/finalized。
我们发现它的文件夹如下

  1. drwxrwxr-x 4 hdfs hdfs 4.0K Jul 24 16:11 ..
  2. drwxrwxr-x 34 hdfs hdfs 4.0K Jul 26 15:20 subdir0
  3. drwxrwxr-x 34 hdfs hdfs 4.0K Aug 8 13:19 subdir1
  4. drwxrwxr-x 34 hdfs hdfs 4.0K Aug 10 08:16 subdir2
  5. drwxrwxr-x 34 hdfs hdfs 4.0K Aug 17 22:16 subdir3
  6. drwxrwxr-x 34 hdfs hdfs 4.0K Aug 23 02:49 subdir4
  7. drwxrwxr-x 34 hdfs hdfs 4.0K Aug 27 20:30 subdir5
  8. drwxrwxr-x 34 hdfs hdfs 4.0K Sep 2 08:30 subdir6
  9. drwxrwxr-x 34 hdfs hdfs 4.0K Sep 7 02:21 subdir7
  10. drwxrwxr-x 34 hdfs hdfs 4.0K Sep 12 18:00 subdir8
  11. drwxrwxr-x 34 hdfs hdfs 4.0K Sep 16 22:46 subdir9
  12. drwxrwxr-x 34 hdfs hdfs 4.0K Sep 23 02:45 subdir10
  13. drwxrwxr-x 34 hdfs hdfs 4.0K Sep 28 22:31 subdir11
  14. drwxrwxr-x 34 hdfs hdfs 4.0K Oct 3 19:15 subdir12
  15. drwxrwxr-x 34 hdfs hdfs 4.0K Oct 8 13:30 subdir13
  16. drwxrwxr-x 17 hdfs hdfs 4.0K Oct 12 15:35 .
  17. drwxrwxr-x 34 hdfs hdfs 4.0K Oct 13 04:46 subdir14

cd子项6

ls-总计688k

  1. drwxrwxr-x 34 hdfs hdfs 4.0K Sep 2 08:30 .
  2. drwxrwxr-x 2 hdfs hdfs 20K Sep 5 22:35 subdir0
  3. drwxrwxr-x 2 hdfs hdfs 20K Sep 5 22:51 subdir1
  4. drwxrwxr-x 2 hdfs hdfs 20K Sep 5 23:34 subdir2
  5. drwxrwxr-x 2 hdfs hdfs 20K Sep 6 00:28 subdir4
  6. drwxrwxr-x 2 hdfs hdfs 20K Sep 6 00:50 subdir5
  7. drwxrwxr-x 2 hdfs hdfs 20K Sep 6 01:36 subdir6
  8. drwxrwxr-x 2 hdfs hdfs 20K Sep 6 01:50 subdir7
  9. drwxrwxr-x 2 hdfs hdfs 20K Sep 6 02:21 subdir8
  10. drwxrwxr-x 2 hdfs hdfs 20K Sep 6 02:50 subdir9
  11. drwxrwxr-x 2 hdfs hdfs 20K Sep 6 03:19 subdir10
  12. drwxrwxr-x 2 hdfs hdfs 20K Sep 6 03:38 subdir11
  13. drwxrwxr-x 2 hdfs hdfs 20K Sep 6 04:19 subdir12
  14. drwxrwxr-x 2 hdfs hdfs 20K Sep 6 04:38 subdir13
  15. drwxrwxr-x 2 hdfs hdfs 20K Sep 6 05:20 subdir14
  16. drwxrwxr-x 2 hdfs hdfs 20K Sep 6 05:49 subdir15
  17. drwxrwxr-x 2 hdfs hdfs 20K Sep 6 06:19 subdir16
  18. drwxrwxr-x 2 hdfs hdfs 20K Sep 6 07:20 subdir18
  19. drwxrwxr-x 2 hdfs hdfs 20K Sep 6 08:06 subdir20
  20. drwxrwxr-x 2 hdfs hdfs 20K Sep 6 08:24 subdir21
  21. drwxrwxr-x 2 hdfs hdfs 20K Sep 6 08:50 subdir22
  22. drwxrwxr-x 2 hdfs hdfs 20K Sep 6 09:23 subdir23
  23. drwxrwxr-x 2 hdfs hdfs 20K Sep 6 09:39 subdir24
  24. drwxrwxr-x 2 hdfs hdfs 20K Sep 6 10:05 subdir25
  25. drwxrwxr-x 2 hdfs hdfs 20K Sep 6 10:26 subdir26
  26. drwxrwxr-x 2 hdfs hdfs 20K Sep 6 11:02 subdir27
  27. drwxrwxr-x 2 hdfs hdfs 20K Sep 6 11:36 subdir28
  28. drwxrwxr-x 2 hdfs hdfs 20K Sep 6 12:04 subdir29
  29. drwxrwxr-x 2 hdfs hdfs 20K Sep 6 12:24 subdir30
  30. drwxrwxr-x 2 hdfs hdfs 20K Sep 6 12:53 subdir31
  31. drwxrwxr-x 2 hdfs hdfs 20K Sep 10 16:12 subdir17
  32. drwxrwxr-x 2 hdfs hdfs 20K Sep 12 16:13 subdir3
  33. drwxrwxr-x 2 hdfs hdfs 20K Sep 13 16:13 subdir19
  34. drwxrwxr-x 17 hdfs hdfs 4.0K Oct 12 15:35 ..

x/当前/最终/细分市场6#cd细分市场0 xx/当前/最终/细分市场6/细分市场0#ls-总计726m

  1. -rw-rw-r-- 1 hdfs hdfs 39K Sep 1 18:35 blk_1074135056_394248.meta
  2. -rw-rw-r-- 1 hdfs hdfs 4.8M Sep 1 18:35 blk_1074135056
  3. -rw-rw-r-- 1 hdfs hdfs 38K Sep 1 18:36 blk_1074135053_394245.meta
  4. -rw-rw-r-- 1 hdfs hdfs 4.8M Sep 1 18:36 blk_1074135053
  5. -rw-rw-r-- 1 hdfs hdfs 40K Sep 1 18:36 blk_1074135055_394247.meta
  6. -rw-rw-r-- 1 hdfs hdfs 5.0M Sep 1 18:36 blk_1074135055
  7. -rw-rw-r-- 1 hdfs hdfs 39K Sep 1 18:36 blk_1074135049_394241.meta
  8. -rw-rw-r-- 1 hdfs hdfs 4.9M Sep 1 18:36 blk_1074135049
  9. -rw-rw-r-- 1 hdfs hdfs 45K Sep 1 18:38 blk_1074135057_394249.meta
  10. -rw-rw-r-- 1 hdfs hdfs 5.6M Sep 1 18:38 blk_1074135057
  11. -rw-rw-r-- 1 hdfs hdfs 39K Sep 1 18:47 blk_1074135070_394262.meta
  12. -rw-rw-r-- 1 hdfs hdfs 4.8M Sep 1 18:47 blk_1074135070
  13. -rw-rw-r-- 1 hdfs hdfs 24K Sep 1 18:47 blk_1074135097_394289.meta
  14. -rw-rw-r-- 1 hdfs hdfs 2.9M Sep 1 18:47 blk_1074135097
  15. -rw-rw-r-- 1 hdfs hdfs 36K Sep 1 18:49 blk_1074135141_394333.meta
  16. -rw-rw-r-- 1 hdfs hdfs 4.5M Sep 1 18:49 blk_1074135141
  17. -rw-rw-r-- 1 hdfs hdfs 23K Sep 1 18:49 blk_1074135142_394334.meta
  18. -rw-rw-r-- 1 hdfs hdfs 2.9M Sep 1 18:49 blk_1074135142
  19. -rw-rw-r-- 1 hdfs hdfs 36K Sep 1 18:49 blk_1074135134_394326.meta
  20. -rw-rw-r-- 1 hdfs hdfs 4.5M Sep 1 18:49 blk_1074135134
  21. -rw-rw-r-- 1 hdfs hdfs 38K Sep 1 18:50 blk_1074135071_394263.meta
yrwegjxp

yrwegjxp1#

您列出的目录由hdfs使用,您可以在主节点上运行以下命令,以确定哪些hdfs文件正在占用空间:

  1. hdfs dfs -du <dir>
  2. hdfs dfsadmin -report

可以使用删除不需要的文件

  1. hdfs dfs -rm -r -f -skipTrash <path>

请参阅《hdfs命令指南》中的更多详细信息。还有一些不错的脚本和工具可能会有用。
注意 /user/spark/eventlog 以及 /tmp/hadoop-yarn/staging/history ,它们通常会随着你做更多的工作而增长。

增加hdfs容量

在标识和删除不需要的文件之前,为了防止hdfs耗尽空间,可以向集群添加更多工作节点作为缓解措施:

  1. gcloud dataproc clusters update <cluster> --num-workers=<num>

请参阅scaling dataproc clusters中的更多详细信息。

spark事件日志

如果它是由spark事件日志或历史文件引起的,对于实时集群,请考虑在中添加这些属性 /etc/spark/conf/spark-defaults.conf :

  1. spark.history.fs.cleaner.enabled=true
  2. spark.history.fs.cleaner.interval=1d
  3. spark.history.fs.cleaner.maxAge=7d

然后用重新启动spark history server

  1. sudo systemctl restart spark-history-server.service

它会帮你清理旧文件。您可以将间隔更改为较小的值,例如。, 10m 如果你想让它运行得更频繁。
对于新群集,请添加以下属性

  1. gcloud dataproc clusters create ... \
  2. --properties spark:spark.history.fs.cleaner.enabled=true,spark:spark.history.fs.cleaner.interval=1d,spark:spark.history.fs.cleaner.maxAge=7d

请参阅相关spark配置上的此文档。顺便说一句,您可以在dataprocwebui中查看spark作业历史记录,在清理一些旧的历史记录文件后,您应该可以看到较少的项目。

展开查看全部
1yjd4xko

1yjd4xko2#

-------很多这样的文件

envsm3lx

envsm3lx3#


  1. -rw-rw-r-- 1 hdfs hdfs 37K Sep 5 22:23 blk_1074192610_451802.meta
  2. -rw-rw-r-- 1 hdfs hdfs 4.6M Sep 5 22:23 blk_1074192610
  3. -rw-rw-r-- 1 hdfs hdfs 37K Sep 5 22:26 blk_1074192592_451784.meta
  4. -rw-rw-r-- 1 hdfs hdfs 4.6M Sep 5 22:26 blk_1074192592
  5. -rw-rw-r-- 1 hdfs hdfs 44K Sep 5 22:33 blk_1074192633_451825.meta
  6. -rw-rw-r-- 1 hdfs hdfs 5.5M Sep 5 22:33 blk_1074192633

我们能删除那些文件吗?
这些文件的目的是什么?

最好的删除方法是什么?

非常感谢你的信息。我已经执行了命令。

  1. ~# hadoop fs -du -h /
  2. 136 /hadoop
  3. 0 /tmp
  4. 1017.5 G /user
  5. # hadoop fs -du -h /user/spark/
  6. 1012.7 G /user/spark/eventlog

事件日志似乎占用了近1tb的空间

  1. :~# hdfs dfsadmin -report
  2. Configured Capacity: 2766820474880 (2.52 TB)
  3. Present Capacity: 2539325628659 (2.31 TB)
  4. DFS Remaining: 331457595322 (308.69 GB)
  5. DFS Used: 2207868033337 (2.01 TB)
  6. DFS Used%: 86.95%
  7. Under replicated blocks: 0
  8. Blocks with corrupt replicas: 0
  9. Missing blocks: 0
  10. Missing blocks (with replication factor 1): 0
  11. Pending deletion blocks: 0
  12. -------------------------------------------------
  13. Live datanodes (7):
  14. Name: XXXXXX
  15. Hostname: XXXXXX-w-0.c.XXXXXXXX
  16. Decommission Status : Normal
  17. Configured Capacity: 395260067840 (368.11 GB)
  18. DFS Used: 328729737718 (306.15 GB)
  19. Non DFS Used: 10792138250 (10.05 GB)
  20. DFS Remaining: 34530736445 (32.16 GB)
  21. DFS Used%: 83.17%
  22. DFS Remaining%: 8.74%
  23. Configured Cache Capacity: 0 (0 B)
  24. Cache Used: 0 (0 B)
  25. Cache Remaining: 0 (0 B)
  26. Cache Used%: 100.00%
  27. Cache Remaining%: 0.00%
  28. Xceivers: 18
  29. Last contact: Wed Oct 14 17:52:46 UTC 2020
  30. Last Block Report: Wed Oct 14 14:32:42 UTC 2020

=================以上是修剪输出。其余6个节点的磁盘使用率几乎相同。
删除事件日志是否安全?我的意思是它会妨碍任何正在运行的作业或集群吗?
我运行下面的命令,以找出有多少文件,我发现它是巨大的。
~#hadoop fs-du-h/user/spark/eventlog | wc-l
236757
所有文件的大小都接近5~6mb。是否有任何命令,我可以删除匹配的文件,至少是7天的旧?

展开查看全部

相关问题