hdfs fsck命令查看HDFS文件对应的文件块信息(Block)和位置信息(Locations)

在HDFS中,提供了fsck命令,用于检查HDFS上文件和目录的健康状态、获取文件的block信息和位置信息等。

fsck命令必须由HDFS超级用户来执行,普通用户无权限。

  1. [hadoop@dev ~]$ hdfs fsck
  2. Usage: DFSck [-list–corruptfileblocks | [-move | –delete | –openforwrite] [-files [-blocks [-locations | –racks]]]]
  3. start checking from this path
  4. –move move corrupted files to /lost+found
  5. –delete delete corrupted files
  6. –files print out files being checked
  7. –openforwrite print out files opened for write
  8. –includeSnapshots include snapshot data if the given path indicates a snapshottable directory orthere are snapshottable directories under it
  9. –list–corruptfileblocks print out list of missing blocks and files they belong to
  10. –blocks print out block report
  11. –locations print out locations for every block
  12. –racks print out network topology for data–node locations
  13. 更多精彩内容 点我学

下面介绍每一个选项的含义及用法。

查看文件中损坏的块(-list-corruptfileblocks)

  1. [hadoop@dev ~]$ hdfs fsck /hivedata/warehouse/liuxiaowen.db/lxw_product_names/ –list–corruptfileblocks
  2. The filesystem under path ‘/hivedata/warehouse/liuxiaowen.db/lxw_product_names/’ has 0CORRUPT files

将损坏的文件移动至/lost+found目录(-move)

  1. [hadoop@dev ~]$ hdfs fsck /hivedata/warehouse/liuxiaowen.db/lxw_product_names/part–00168–move
  2. FSCK started by hadoop (auth:SIMPLE) from /172.16.212.17 for path /hivedata/warehouse/liuxiaowen.db/lxw_product_names/part–00168 at Thu Aug 13 09:36:35 CST 2015
  3. .Status: HEALTHY
  4. Total size: 13497058 B
  5. Total dirs: 0
  6. Total files: 1
  7. Total symlinks: 0
  8. Total blocks (validated): 1 (avg. block size 13497058 B)
  9. Minimally replicated blocks: 1 (100.0 %)
  10. Over–replicated blocks: 0 (0.0 %)
  11. Under–replicated blocks: 0 (0.0 %)
  12. Mis–replicated blocks: 0 (0.0 %)
  13. Default replication factor: 2
  14. Average block replication: 2.0
  15. Corrupt blocks: 0
  16. Missing replicas: 0 (0.0 %)
  17. Number of data–nodes: 15
  18. Number of racks: 1
  19. FSCK ended at Thu Aug 13 09:36:35 CST 2015 in 1 milliseconds
  20.  
  21.  
  22. The filesystem under path ‘/hivedata/warehouse/liuxiaowen.db/lxw_product_names/part-00168’is HEALTHY
  23. 更多精彩内容 点我学
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值