我们有 1 个主节点和 7 个工作节点的 Dataproc 集群。所有工作节点都有 1 个引导磁盘和 1 个 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-XXXXXXX-XX.XX.XX.X-XXXXXXXX/current/finalized .
我们发现它下面有文件夹
drwxrwxr-x 4 hdfs hdfs 4.0K Jul 24 16:11 ..
drwxrwxr-x 34 hdfs hdfs 4.0K Jul 26 15:20 subdir0
drwxrwxr-x 34 hdfs hdfs 4.0K Aug 8 13:19 subdir1
drwxrwxr-x 34 hdfs hdfs 4.0K Aug 10 08:16 subdir2
drwxrwxr-x 34 hdfs hdfs 4.0K Aug 17 22:16 subdir3
drwxrwxr-x 34 hdfs hdfs 4.0K Aug 23 02:49 subdir4
drwxrwxr-x 34 hdfs hdfs 4.0K Aug 27 20:30 subdir5
drwxrwxr-x 34 hdfs hdfs 4.0K Sep 2 08:30 subdir6
drwxrwxr-x 34 hdfs hdfs 4.0K Sep 7 02:21 subdir7
drwxrwxr-x 34 hdfs hdfs 4.0K Sep 12 18:00 subdir8
drwxrwxr-x 34 hdfs hdfs 4.0K Sep 16 22:46 subdir9
drwxrwxr-x 34 hdfs hdfs 4.0K Sep 23 02:45 subdir10
drwxrwxr-x 34 hdfs hdfs 4.0K Sep 28 22:31 subdir11
drwxrwxr-x 34 hdfs hdfs 4.0K Oct 3 19:15 subdir12
drwxrwxr-x 34 hdfs hdfs 4.0K Oct 8 13:30 subdir13
drwxrwxr-x 17 hdfs hdfs 4.0K Oct 12 15:35 .
drwxrwxr-x 34 hdfs hdfs 4.0K Oct 13 04:46 subdir14
cd subdir6
ls -larth 总计 688K
drwxrwxr-x 34 hdfs hdfs 4.0K Sep 2 08:30 .
drwxrwxr-x 2 hdfs hdfs 20K Sep 5 22:35 subdir0
drwxrwxr-x 2 hdfs hdfs 20K Sep 5 22:51 subdir1
drwxrwxr-x 2 hdfs hdfs 20K Sep 5 23:34 subdir2
drwxrwxr-x 2 hdfs hdfs 20K Sep 6 00:28 subdir4
drwxrwxr-x 2 hdfs hdfs 20K Sep 6 00:50 subdir5
drwxrwxr-x 2 hdfs hdfs 20K Sep 6 01:36 subdir6
drwxrwxr-x 2 hdfs hdfs 20K Sep 6 01:50 subdir7
drwxrwxr-x 2 hdfs hdfs 20K Sep 6 02:21 subdir8
drwxrwxr-x 2 hdfs hdfs 20K Sep 6 02:50 subdir9
drwxrwxr-x 2 hdfs hdfs 20K Sep 6 03:19 subdir10
drwxrwxr-x 2 hdfs hdfs 20K Sep 6 03:38 subdir11
drwxrwxr-x 2 hdfs hdfs 20K Sep 6 04:19 subdir12
drwxrwxr-x 2 hdfs hdfs 20K Sep 6 04:38 subdir13
drwxrwxr-x 2 hdfs hdfs 20K Sep 6 05:20 subdir14
drwxrwxr-x 2 hdfs hdfs 20K Sep 6 05:49 subdir15
drwxrwxr-x 2 hdfs hdfs 20K Sep 6 06:19 subdir16
drwxrwxr-x 2 hdfs hdfs 20K Sep 6 07:20 subdir18
drwxrwxr-x 2 hdfs hdfs 20K Sep 6 08:06 subdir20
drwxrwxr-x 2 hdfs hdfs 20K Sep 6 08:24 subdir21
drwxrwxr-x 2 hdfs hdfs 20K Sep 6 08:50 subdir22
drwxrwxr-x 2 hdfs hdfs 20K Sep 6 09:23 subdir23
drwxrwxr-x 2 hdfs hdfs 20K Sep 6 09:39 subdir24
drwxrwxr-x 2 hdfs hdfs 20K Sep 6 10:05 subdir25
drwxrwxr-x 2 hdfs hdfs 20K Sep 6 10:26 subdir26
drwxrwxr-x 2 hdfs hdfs 20K Sep 6 11:02 subdir27
drwxrwxr-x 2 hdfs hdfs 20K Sep 6 11:36 subdir28
drwxrwxr-x 2 hdfs hdfs 20K Sep 6 12:04 subdir29
drwxrwxr-x 2 hdfs hdfs 20K Sep 6 12:24 subdir30
drwxrwxr-x 2 hdfs hdfs 20K Sep 6 12:53 subdir31
drwxrwxr-x 2 hdfs hdfs 20K Sep 10 16:12 subdir17
drwxrwxr-x 2 hdfs hdfs 20K Sep 12 16:13 subdir3
drwxrwxr-x 2 hdfs hdfs 20K Sep 13 16:13 subdir19
drwxrwxr-x 17 hdfs hdfs 4.0K Oct 12 15:35 ..
XXXX/current/finalized/subdir6# cd subdir0 XXXXXX/current/finalized/subdir6/subdir0# ls -larth 总计 726M
-rw-rw-r-- 1 hdfs hdfs 39K Sep 1 18:35 blk_1074135056_394248.meta
-rw-rw-r-- 1 hdfs hdfs 4.8M Sep 1 18:35 blk_1074135056
-rw-rw-r-- 1 hdfs hdfs 38K Sep 1 18:36 blk_1074135053_394245.meta
-rw-rw-r-- 1 hdfs hdfs 4.8M Sep 1 18:36 blk_1074135053
-rw-rw-r-- 1 hdfs hdfs 40K Sep 1 18:36 blk_1074135055_394247.meta
-rw-rw-r-- 1 hdfs hdfs 5.0M Sep 1 18:36 blk_1074135055
-rw-rw-r-- 1 hdfs hdfs 39K Sep 1 18:36 blk_1074135049_394241.meta
-rw-rw-r-- 1 hdfs hdfs 4.9M Sep 1 18:36 blk_1074135049
-rw-rw-r-- 1 hdfs hdfs 45K Sep 1 18:38 blk_1074135057_394249.meta
-rw-rw-r-- 1 hdfs hdfs 5.6M Sep 1 18:38 blk_1074135057
-rw-rw-r-- 1 hdfs hdfs 39K Sep 1 18:47 blk_1074135070_394262.meta
-rw-rw-r-- 1 hdfs hdfs 4.8M Sep 1 18:47 blk_1074135070
-rw-rw-r-- 1 hdfs hdfs 24K Sep 1 18:47 blk_1074135097_394289.meta
-rw-rw-r-- 1 hdfs hdfs 2.9M Sep 1 18:47 blk_1074135097
-rw-rw-r-- 1 hdfs hdfs 36K Sep 1 18:49 blk_1074135141_394333.meta
-rw-rw-r-- 1 hdfs hdfs 4.5M Sep 1 18:49 blk_1074135141
-rw-rw-r-- 1 hdfs hdfs 23K Sep 1 18:49 blk_1074135142_394334.meta
-rw-rw-r-- 1 hdfs hdfs 2.9M Sep 1 18:49 blk_1074135142
-rw-rw-r-- 1 hdfs hdfs 36K Sep 1 18:49 blk_1074135134_394326.meta
-rw-rw-r-- 1 hdfs hdfs 4.5M Sep 1 18:49 blk_1074135134
-rw-rw-r-- 1 hdfs hdfs 38K Sep 1 18:50 blk_1074135071_394263.meta
--------------- 很多很多这样的文件 ---------------
-rw-rw-r-- 1 hdfs hdfs 37K Sep 5 22:23 blk_1074192610_451802.meta
-rw-rw-r-- 1 hdfs hdfs 4.6M Sep 5 22:23 blk_1074192610
-rw-rw-r-- 1 hdfs hdfs 37K Sep 5 22:26 blk_1074192592_451784.meta
-rw-rw-r-- 1 hdfs hdfs 4.6M Sep 5 22:26 blk_1074192592
-rw-rw-r-- 1 hdfs hdfs 44K Sep 5 22:33 blk_1074192633_451825.meta
-rw-rw-r-- 1 hdfs hdfs 5.5M Sep 5 22:33 blk_1074192633
- 我们可以删除那些文件吗?
- 这些文件的目的是什么?
删除这些的最佳方法是什么?
非常感谢您的信息。我已经运行了命令。
~# hadoop fs -du -h /
136 /hadoop
0 /tmp
1017.5 G /user
# hadoop fs -du -h /user/spark/
1012.7 G /user/spark/eventlog
事件日志似乎占用了将近 1TB
:~# hdfs dfsadmin -report
Configured Capacity: 2766820474880 (2.52 TB)
Present Capacity: 2539325628659 (2.31 TB)
DFS Remaining: 331457595322 (308.69 GB)
DFS Used: 2207868033337 (2.01 TB)
DFS Used%: 86.95%
Under replicated blocks: 0
Blocks with corrupt replicas: 0
Missing blocks: 0
Missing blocks (with replication factor 1): 0
Pending deletion blocks: 0
-------------------------------------------------
Live datanodes (7):
Name: XXXXXX
Hostname: XXXXXX-w-0.c.XXXXXXXX
Decommission Status : Normal
Configured Capacity: 395260067840 (368.11 GB)
DFS Used: 328729737718 (306.15 GB)
Non DFS Used: 10792138250 (10.05 GB)
DFS Remaining: 34530736445 (32.16 GB)
DFS Used%: 83.17%
DFS Remaining%: 8.74%
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: 18
Last contact: Wed Oct 14 17:52:46 UTC 2020
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 天前的匹配文件?