澶辨晥閾炬帴澶勭悊 |
Hadoop fs鍛戒護(hù)璇﹁В PDF 涓嬭澆
鏈珯鏁寸悊涓嬭澆錛?/strong>
閾炬帴錛?a target="_blank">https://pan.baidu.com/s/1m_RVUyOYnOsrLl1684-N2A
鎻愬彇鐮侊細(xì)hrzs
鐩稿叧鎴浘錛?/strong>
![]()
涓昏鍐呭錛?/strong>
1.appendToFile
Usage: Hadoop fs -appendToFile <localsrc> ... <dst>
Append single src, or multiple srcs from local file system to the destination file system. Also reads input from stdin and appends to destination file system.
飩穐adoop fs -appendToFile localfile /user/hadoop/hadoopfile
飩穐adoop fs -appendToFile localfile1 localfile2 /user/hadoop/hadoopfile
飩穐adoop fs -appendToFile localfile hdfs://nn.example.com/hadoop/hadoopfile
飩穐adoop fs -appendToFile - hdfs://nn.example.com/hadoop/hadoopfile Reads the input from stdin.
Exit Code:
Returns 0 on success and 1 on error.
2. cat
Usage: hadoop fs -cat URI [URI ...]
Copies source paths to stdout.
Example:
飩穐adoop fs -cat hdfs://nn1.example.com/file1 hdfs://nn2.example.com/file2
飩穐adoop fs -cat file:///file3 /user/hadoop/file4
Exit Code:
Returns 0 on success and -1 on error.
3. checksum
Usage: hadoop fs -checksum URI
Returns the checksum information of a file.
Example:
飩穐adoop fs -checksum hdfs://nn1.example.com/file1
飩穐adoop fs -checksum file:///etc/hosts
4. chgrp
Usage: hadoop fs -chgrp [-R] GROUP URI [URI ...]
Change group association of files. The user must be the owner of files, or else a super-user. Additional information is in thePermissions Guide.
Options
飩稵he -R option will make the change recursively through the directory structure.
5. chmod
Usage: hadoop fs -chmod [-R] <MODE[,MODE]... | OCTALMODE> URI [URI ...]
Change the permissions of files. With -R, make the change recursively through the directory structure. The user must be the owner of the file, or else a super-user. Additional information is in thePermissions Guide.
Options
飩稵he -R option will make the change recursively through the directory structure.
6. chown
Usage: hadoop fs -chown [-R] [OWNER][:[GROUP]] URI [URI ]
Change the owner of files. The user must be a super-user. Additional information is in thePermissions Guide.
Options
飩稵he -R option will make the change recursively through the directory structure.
7. copyFromLocal
Usage: hadoop fs -copyFromLocal <localsrc> URI
Similar to put command, except that the source is restricted to a local file reference.
Options:
飩稵he -f option will overwrite the destination if it already exists.
8. copyToLocal
Usage: hadoop fs -copyToLocal [-ignorecrc] [-crc] URI <localdst>
Similar to get command, except that the destination is restricted to a local file reference.
9. count
Usage: hadoop fs -count [-q] [-h] [-v] <paths>
Count the number of directories, files and bytes under the paths that match the specified file pattern. The output columns with -count are: DIR_COUNT, FILE_COUNT, CONTENT_SIZE, PATHNAME
The output columns with -count -q are: QUOTA, REMAINING_QUATA, SPACE_QUOTA, REMAINING_SPACE_QUOTA, DIR_COUNT, FILE_COUNT, CONTENT_SIZE, PATHNAME
The -h option shows sizes in human readable format.
The -v option displays a header line.
Example:
飩穐adoop fs -count hdfs://nn1.example.com/file1 hdfs://nn2.example.com/file2
飩穐adoop fs -count -q hdfs://nn1.example.com/file1
飩穐adoop fs -count -q -h hdfs://nn1.example.com/file1
飩穐dfs dfs -count -q -h -v hdfs://nn1.example.com/file1
Exit Code:
Returns 0 on success and -1 on error.
10. cp
Usage: hadoop fs -cp [-f] [-p | -p[topax]] URI [URI ...] <dest>
Copy files from source to destination. This command allows multiple sources as well in which case the destination must be a directory.
‘raw.*’ namespace extended attributes are preserved if (1) the source and destination filesystems support them (HDFS only), and (2) all source and destination pathnames are in the /.reserved/raw hierarchy. Determination of whether raw.* namespace xattrs are preserved is independent of the -p (preserve) flag.
Options:
飩稵he -f option will overwrite the destination if it already exists.
飩稵he -p option will preserve file attributes [topx] (timestamps, ownership, permission, ACL, XAttr). If -p is specified with noarg, then preserves timestamps, ownership, permission. If -pa is specified, then preserves permission also because ACL is a super-set of permission. Determination of whether raw namespace extended attributes are preserved is independent of the -p flag.
Example:
飩穐adoop fs -cp /user/hadoop/file1 /user/hadoop/file2
飩穐adoop fs -cp /user/hadoop/file1 /user/hadoop/file2 /user/hadoop/dir
Exit Code:
Returns 0 on success and -1 on error.
|