查看hdfs各目录分别占用多少空间
之前在网上搜索到的全部单位好像都是byte的,看起来很麻烦,然后自己看了下
hadoop fs -help
[hadoop@slave3 java]$ hadoop fs -help
Usage: hadoop fs [generic options]
[-appendToFile <localsrc> ... <dst>]
[-cat [-ignoreCrc] <src> ...]
[-checksum <src> ...]
[-chgrp [-R] GROUP PATH...]
[-chmod [-R] <MODE[,MODE]... | OCTALMODE> PATH...]
[-chown [-R] [OWNER][:[GROUP]] PATH...]
[-copyFromLocal [-f] [-p] [-l] <localsrc> ... <dst>]
[-copyToLocal [-p] [-ignoreCrc] [-crc] <src> ... <localdst>]
[-count [-q] [-h] <path> ...]
[-cp [-f] [-p | -p[topax]] <src> ... <dst>]
[-createSnapshot <snapshotDir> [<snapshotName>]]
[-deleteSnapshot <snapshotDir> <snapshotName>]
[-df [-h] [<path> ...]]
[-du [-s] [-h] <path> ...]
[-expunge]
[-get [-p] [-ignoreCrc] [-crc] <src> ... <localdst>]
[-getfacl [-R] <path>]
[-getfattr [-R] {-n name | -d} [-e en] <path>]
[-getmerge [-nl] <src> <localdst>]
[-help [cmd ...]]
[-ls [-d] [-h] [-R] [<path> ...]]
[-mkdir [-p] <path> ...]
[-moveFromLocal <localsrc> ... <dst>]
[-moveToLocal <src> <localdst>]
[-mv <src> ... <dst>]
[-put [-f] [-p] [-l] <localsrc> ... <dst>]
[-renameSnapshot <snapshotDir> <oldName> <newName>]
[-rm [-f] [-r|-R] [-skipTrash] <src> ...]
[-rmdir [--ignore-fail-on-non-empty] <dir> ...]
[-setfacl [-R] [{-b|-k} {-m|-x <acl_spec>} <path>]|[--set <acl_spec> <path>]]
[-setfattr {-n name [-v value] | -x name} <path>]
[-setrep [-R] [-w] <rep> <path> ...]
[-stat [format] <path> ...]
[-tail [-f] <file>]
[-test -[defsz] <path>]
[-text [-ignoreCrc] <src> ...]
[-touchz <path> ...]
[-usage [cmd ...]] -appendToFile <localsrc> ... <dst> :
Appends the contents of all the given local files to the given dst file. The dst
file will be created if it does not exist. If <localSrc> is -, then the input is
read from stdin. -cat [-ignoreCrc] <src> ... :
Fetch all files that match the file pattern <src> and display their content on
stdout. -checksum <src> ... :
Dump checksum information for files that match the file pattern <src> to stdout.
Note that this requires a round-trip to a datanode storing each block of the
file, and thus is not efficient to run on a large number of files. The checksum
of a file depends on its content, block size and the checksum algorithm and
parameters used for creating the file. -chgrp [-R] GROUP PATH... :
This is equivalent to -chown ... :GROUP ... -chmod [-R] <MODE[,MODE]... | OCTALMODE> PATH... :
Changes permissions of a file. This works similar to the shell's chmod command
with a few exceptions. -R modifies the files recursively. This is the only option currently
supported.
<MODE> Mode is the same as mode used for the shell's command. The only
letters recognized are 'rwxXt', e.g. +t,a+r,g-w,+rwx,o=r.
<OCTALMODE> Mode specifed in 3 or 4 digits. If 4 digits, the first may be 1 or
0 to turn the sticky bit on or off, respectively. Unlike the
shell command, it is not possible to specify only part of the
mode, e.g. 754 is same as u=rwx,g=rx,o=r. If none of 'augo' is specified, 'a' is assumed and unlike the shell command, no
umask is applied. -chown [-R] [OWNER][:[GROUP]] PATH... :
Changes owner and group of a file. This is similar to the shell's chown command
with a few exceptions. -R modifies the files recursively. This is the only option currently
supported. If only the owner or group is specified, then only the owner or group is
modified. The owner and group names may only consist of digits, alphabet, and
any of [-_./@a-zA-Z0-9]. The names are case sensitive. WARNING: Avoid using '.' to separate user name and group though Linux allows it.
If user names have dots in them and you are using local file system, you might
see surprising results since the shell command 'chown' is used for local files. -copyFromLocal [-f] [-p] [-l] <localsrc> ... <dst> :
Identical to the -put command. -copyToLocal [-p] [-ignoreCrc] [-crc] <src> ... <localdst> :
Identical to the -get command. -count [-q] [-h] <path> ... :
Count the number of directories, files and bytes under the paths
that match the specified file pattern. The output columns are:
DIR_COUNT FILE_COUNT CONTENT_SIZE FILE_NAME or
QUOTA REMAINING_QUOTA SPACE_QUOTA REMAINING_SPACE_QUOTA
DIR_COUNT FILE_COUNT CONTENT_SIZE FILE_NAME
The -h option shows file sizes in human readable format. -cp [-f] [-p | -p[topax]] <src> ... <dst> :
Copy files that match the file pattern <src> to a destination. When copying
multiple files, the destination must be a directory. Passing -p preserves status
[topax] (timestamps, ownership, permission, ACLs, XAttr). If -p is specified
with no <arg>, then preserves timestamps, ownership, permission. If -pa is
specified, then preserves permission also because ACL is a super-set of
permission. Passing -f overwrites the destination if it already exists. raw
namespace extended attributes are preserved if (1) they are supported (HDFS
only) and, (2) all of the source and target pathnames are in the /.reserved/raw
hierarchy. raw namespace xattr preservation is determined solely by the presence
(or absence) of the /.reserved/raw prefix and not by the -p option. -createSnapshot <snapshotDir> [<snapshotName>] :
Create a snapshot on a directory -deleteSnapshot <snapshotDir> <snapshotName> :
Delete a snapshot from a directory -df [-h] [<path> ...] :
Shows the capacity, free and used space of the filesystem. If the filesystem has
multiple partitions, and no path to a particular partition is specified, then
the status of the root partitions will be shown. -h Formats the sizes of files in a human-readable fashion rather than a number
of bytes. -du [-s] [-h] <path> ... :
Show the amount of space, in bytes, used by the files that match the specified
file pattern. The following flags are optional: -s Rather than showing the size of each individual file that matches the
pattern, shows the total (summary) size.
-h Formats the sizes of files in a human-readable fashion rather than a number
of bytes. Note that, even without the -s option, this only shows size summaries one level
deep into a directory. The output is in the form
size disk space consumed name(full path) -expunge :
Empty the Trash -get [-p] [-ignoreCrc] [-crc] <src> ... <localdst> :
Copy files that match the file pattern <src> to the local name. <src> is kept.
When copying multiple files, the destination must be a directory. Passing -p
preserves access and modification times, ownership and the mode. -getfacl [-R] <path> :
Displays the Access Control Lists (ACLs) of files and directories. If a
directory has a default ACL, then getfacl also displays the default ACL. -R List the ACLs of all files and directories recursively.
<path> File or directory to list. -getfattr [-R] {-n name | -d} [-e en] <path> :
Displays the extended attribute names and values (if any) for a file or
directory. -R Recursively list the attributes for all files and directories.
-n name Dump the named extended attribute value.
-d Dump all extended attribute values associated with pathname.
-e <encoding> Encode values after retrieving them.Valid encodings are "text",
"hex", and "base64". Values encoded as text strings are enclosed
in double quotes ("), and values encoded as hexadecimal and
base64 are prefixed with 0x and 0s, respectively.
<path> The file or directory. -getmerge [-nl] <src> <localdst> :
Get all the files in the directories that match the source file pattern and
merge and sort them to only one file on local fs. <src> is kept. -nl Add a newline character at the end of each file. -help [cmd ...] :
Displays help for given command or all commands if none is specified. -ls [-d] [-h] [-R] [<path> ...] :
List the contents that match the specified file pattern. If path is not
specified, the contents of /user/<currentUser> will be listed. Directory entries
are of the form:
permissions - userId groupId sizeOfDirectory(in bytes)
modificationDate(yyyy-MM-dd HH:mm) directoryName and file entries are of the form:
permissions numberOfReplicas userId groupId sizeOfFile(in bytes)
modificationDate(yyyy-MM-dd HH:mm) fileName -d Directories are listed as plain files.
-h Formats the sizes of files in a human-readable fashion rather than a number
of bytes.
-R Recursively list the contents of directories. -mkdir [-p] <path> ... :
Create a directory in specified location. -p Do not fail if the directory already exists -moveFromLocal <localsrc> ... <dst> :
Same as -put, except that the source is deleted after it's copied. -moveToLocal <src> <localdst> :
Not implemented yet -mv <src> ... <dst> :
Move files that match the specified file pattern <src> to a destination <dst>.
When moving multiple files, the destination must be a directory. -put [-f] [-p] [-l] <localsrc> ... <dst> :
Copy files from the local file system into fs. Copying fails if the file already
exists, unless the -f flag is given.
Flags: -p Preserves access and modification times, ownership and the mode.
-f Overwrites the destination if it already exists.
-l Allow DataNode to lazily persist the file to disk. Forces
replication factor of 1. This flag will result in reduced
durability. Use with care. -renameSnapshot <snapshotDir> <oldName> <newName> :
Rename a snapshot from oldName to newName -rm [-f] [-r|-R] [-skipTrash] <src> ... :
Delete all files that match the specified file pattern. Equivalent to the Unix
command "rm <src>" -skipTrash option bypasses trash, if enabled, and immediately deletes <src>
-f If the file does not exist, do not display a diagnostic message or
modify the exit status to reflect an error.
-[rR] Recursively deletes directories -rmdir [--ignore-fail-on-non-empty] <dir> ... :
Removes the directory entry specified by each directory argument, provided it is
empty. -setfacl [-R] [{-b|-k} {-m|-x <acl_spec>} <path>]|[--set <acl_spec> <path>] :
Sets Access Control Lists (ACLs) of files and directories.
Options: -b Remove all but the base ACL entries. The entries for user, group
and others are retained for compatibility with permission bits.
-k Remove the default ACL.
-R Apply operations to all files and directories recursively.
-m Modify ACL. New entries are added to the ACL, and existing entries
are retained.
-x Remove specified ACL entries. Other ACL entries are retained.
--set Fully replace the ACL, discarding all existing entries. The
<acl_spec> must include entries for user, group, and others for
compatibility with permission bits.
<acl_spec> Comma separated list of ACL entries.
<path> File or directory to modify. -setfattr {-n name [-v value] | -x name} <path> :
Sets an extended attribute name and value for a file or directory. -n name The extended attribute name.
-v value The extended attribute value. There are three different encoding
methods for the value. If the argument is enclosed in double quotes,
then the value is the string inside the quotes. If the argument is
prefixed with 0x or 0X, then it is taken as a hexadecimal number. If
the argument begins with 0s or 0S, then it is taken as a base64
encoding.
-x name Remove the extended attribute.
<path> The file or directory. -setrep [-R] [-w] <rep> <path> ... :
Set the replication level of a file. If <path> is a directory then the command
recursively changes the replication factor of all files under the directory tree
rooted at <path>. -w It requests that the command waits for the replication to complete. This
can potentially take a very long time.
-R It is accepted for backwards compatibility. It has no effect. -stat [format] <path> ... :
Print statistics about the file/directory at <path> in the specified format.
Format accepts filesize in blocks (%b), group name of owner(%g), filename (%n),
block size (%o), replication (%r), user name of owner(%u), modification date
(%y, %Y) -tail [-f] <file> :
Show the last 1KB of the file. -f Shows appended data as the file grows. -test -[defsz] <path> :
Answer various questions about <path>, with result via exit status.
-d return 0 if <path> is a directory.
-e return 0 if <path> exists.
-f return 0 if <path> is a file.
-s return 0 if file <path> is greater than zero bytes in size.
-z return 0 if file <path> is zero bytes in size, else return 1. -text [-ignoreCrc] <src> ... :
Takes a source file and outputs the file in text format.
The allowed formats are zip and TextRecordInputStream and Avro. -touchz <path> ... :
Creates a file of zero length at <path> with current time as the timestamp of
that <path>. An error is returned if the file exists with non-zero length -usage [cmd ...] :
Displays the usage for given command or all commands if none is specified. Generic options supported are
-conf <configuration file> specify an application configuration file
-D <property=value> use value for given property
-fs <local|namenode:port> specify a namenode
-jt <local|resourcemanager:port> specify a ResourceManager
-files <comma separated list of files> specify comma separated files to be copied to the map reduce cluster
-libjars <comma separated list of jars> specify comma separated jar files to include in the classpath.
-archives <comma separated list of archives> specify comma separated archives to be unarchived on the compute machines. The general command line syntax is
bin/hadoop command [genericOptions] [commandOptions]
hadoop fs -du -h /
[hadoop@slave3 java]$ hadoop fs -du -h /
664.7 M 1.3 G /community
13.3 G 26.6 G /data1
12.2 G 25.3 G /hbase
66.5 G 133.0 G /hive
112.5 G 225.0 G /info
851.9 K 1.7 M /jar
3.1 G 6.2 G /rank
221.9 M 443.8 M /sh
1.8 G 8.8 G /tmp
6.8 G 13.5 G /tuitui99
407.7 G 815.4 G /tuitui_logs
38.4 M 76.7 M /usr
9.7 G 29.0 G /yl
hadoop fs -du -h /tmp
[hadoop@slave3 java]$ hadoop fs -du -h /tmp
813.4 M 6.9 G /tmp/hadoop-yarn
988.9 M 1.9 G /tmp/hive
0 0 /tmp/ll
[hadoop@slave3 java]$ hadoop fs -du -h /tuitui_logs
407.7 G 815.4 G /tuitui_logs/logs
[hadoop@slave3 java]$ hadoop fs -du -h /tuitui_logs/logs
141.4 G 282.8 G /tuitui_logs/logs/155
14.8 G 29.5 G /tuitui_logs/logs/156
2.7 G 5.5 G /tuitui_logs/logs/bj
7.6 G 15.1 G /tuitui_logs/logs/cd
4.8 G 9.7 G /tuitui_logs/logs/dl
48.8 G 97.7 G /tuitui_logs/logs/gz
2.5 G 5.0 G /tuitui_logs/logs/jn
137.9 G 275.9 G /tuitui_logs/logs/sh
44.4 G 88.9 G /tuitui_logs/logs/sz
2.1 G 4.2 G /tuitui_logs/logs/tj
639.5 M 1.2 G /tuitui_logs/logs/wh
[hadoop@slave3 java]$
很简单明了,前面的数字即为目录所占空间的大小,后面的因为我前期 备份数为3 后期改为2 所以可能会不一样
查看hdfs各目录分别占用多少空间的更多相关文章
- 如何查看SQLServer数据库每个表占用的空间大小?
如何查看SQLServer数据库每个表占用的空间大小? 创建存储过程: CREATE PROCEDURE [dbo].[sys_viewTableSpace]AS BEGIN SET NOCOUNT ...
- 查看Sql Server所有表占用的空间大小
2010-01-26 sp_spaceused可以查看某个表占用的空间,但不能一次查看所有的表.今天研究了一下这个sp,写了下面这个查询: --刷新系统数据dbcc updateusage(0) wi ...
- 查看MYSQL中数据表占用的空间
由于数据太大了.所以MYSQL需要瘦身,那前提就是需要知道每个表占用的空间大小. 首先打开指定的数据库: use information_schema; 如果想看指定数据库中的数据表,可以用如下语句: ...
- 查看MSSQL数据库每个表占用的空间大小
需要查看数据库表的大小,查询SQL Server联机从书得到如下语句: sp_spaceused 显示行数.保留的磁盘空间以及当前数据库中的表所使用的磁盘空间,或显示由整个数据库保留和使用的磁盘空间. ...
- 查看SQLServer数据库每个表占用的空间大小
创建存储过程: CREATE PROCEDURE [dbo].[sys_viewTableSpace] AS BEGIN SET NOCOUNT ON; CREATE TABLE [dbo].#tab ...
- 如何查看MySQL中每张表占用的空间大小
如题,找到MySQL中的information_schema表,这张表记录了所有数据库中表的信息,主要字段含义如下: TABLE_SCHEMA : 数据库名 TABLE_NAME:表名 ENGINE: ...
- MySQL查看数据库中所有表占用的空间大小
select TABLE_NAME, concat(truncate(data_length/1024/1024,2),'MB') as data_size, concat(truncate(inde ...
- linux下使用 du查看某个文件或目录占用磁盘空间的大小
du -ah --max-depth=1 这个是我想要的结果 a显示目录占用的磁盘空间大小,还要显示其下目录和文件占用磁盘空间的大小但是由于用了--max-depth选项,表示显示目录下所有 ...
- du查看某个文件或目录占用磁盘空间的大小
一.du的功能:`du` reports the amount of disk space used by the specified files and for each subdirectory ...
随机推荐
- ZC_注意点
1. domain类 里面的 属性的类型,一般都是用 包装类 2. 使用 "Hibernate Reverse Engineering ..." 来进行自动生成domain类和?? ...
- 查询优化 | MySQL慢查询优化
Explain查询:rows,定位性能瓶颈. 只需要一行数据时,使用LIMIT1. 在搜索字段上建立索引. 使用ENUM而非VARCHAR. 选择区分度高的列作为索引. 采用扩展索引,而不是新建索引 ...
- 维度属性的KeyColumns,NameColumn和ValueColumn
维度的每一个属性都有KeyColumns,NameColumn和ValueColumn 1,如何理解KeyColumns,NameColumn和ValueColumn?对一行记录有不同的标识列,但 ...
- SSIS包的组建之连接管理器
上一篇我们通过一个示例来介绍一下SSIS 包的开发.接下来的内容我们将学习一下包中各个选项卡的使用.如:连接管理器选项卡.控制流选项卡.数据流选项卡和事件处理选项卡等等.这一篇将介绍一下连接管理器作用 ...
- MySQL 索引的知识整理
前言: 很多面试者,在面试的时候,都会回答,”索引就相当于一本书的字典,有了他能够很快的找到数据”, 这种答案好像在读书的时候老师告诉这么说的吧.今天来全面的描述一下数据库索引的原理及优化 ...
- AI探索(二)Tensorflow环境准备
Python + Tensorflow环境安装 Tensorflow支持Windows/Mac/Linux等三种操作系统, 其中windows下python需要安装3.5以上的版本 Mac/Linux ...
- 【Oracle】异常信息的加工处理
引言 很多时候,我们调用oracle存储过程都会发生各种各样的异常信息,例如ORA-12899值过大,ORA-01400不能插入空值等.虽然说这类异常是前端没控制到位的缘故,但是现实很难100 ...
- JavaScript中的数组和对象 增删遍
由于 JavaScript 的语言特性,我们可以向通用对象动态添加和删除属性.所以 Object 也可以看成是 JS 的一种特殊的集合. 虽然这个集合的 key 只能是 String 类型,不像 Ja ...
- hive_异常_01_ Terminal initialization failed; falling back to unsupported
一.异常现象 hive初始化数据库时,在执行了 schematool -initSchema -dbType mysql 这个命令时,终端抛出如下异常: [ray@rayner bin]$ schem ...
- LeetCode OJ:Path Sum II(路径和II)
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given su ...