首页 > 大数据平台 > hadoop > hadoop hdfs 命令行查看空间情况和设置文件夹大小
2015
11-04

hadoop hdfs 命令行查看空间情况和设置文件夹大小

>>hdfs dfsadmin -report
》bin/hdfs dfs -put readme.txt /finance

》bin/hdfs dfs -du -s /finance
》3901 /finance

》bin/hdfs dfsadmin -setSpaceQuota 4000 /finance
设置/finance的大小上限为4000个字节

》bin/hdfs dfs -put readme1.txt /finance
由于已经超出4000个字节,则会报错

14/03/04 11:56:31 WARN hdfs.DFSClient: DataStreamer Exception
org.apache.hadoop.hdfs.protocol.DSQuotaExceededException: The DiskSpace quota of /finance is exceeded: quota = 4000 B = 3.91 KB but diskspace consumed = 268443258 B = 256.01 MB
at org.apache.hadoop.hdfs.server.namenode.INodeDirectoryWithQuota.verifyQuota(INodeDirectoryWithQuota.java:191)
at org.apache.hadoop.hdfs.server.namenode.FSDirectory.verifyQuota(FSDirectory.java:2054)
at org.apache.hadoop.hdfs.server.namenode.FSDirectory.updateCount(FSDirectory.java:1789)
at org.apache.hadoop.hdfs.server.namenode.FSDirectory.updateCount(FSDirectory.java:1764)
at org.apache.hadoop.hdfs.server.namenode.FSDirectory.addBlock(FSDirectory.java:357)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.saveAllocatedBlock(FSNamesystem.java:2847)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getAdditionalBlock(FSNamesystem.java:2508)
at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.addBlock(NameNodeRpcServer.java:555)
at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.addBlock(ClientNamenodeProtocolServerSideTranslatorPB.java:387)

》bin/hdfs dfsadmin -report
Configured Capacity: 1396849872273408 (1.24 PB)
Present Capacity: 1334169304351514 (1.18 PB)
DFS Remaining: 613060309233664 (557.58 TB)
DFS Used: 721108995117850 (655.84 TB)
DFS Used%: 54.05%
Under replicated blocks: 0
Blocks with corrupt replicas: 0
Missing blocks: 0

最后编辑:
作者:saunix
大型互联网公司linux系统运维攻城狮,专门担当消防员

留下一个回复