Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

HDFS usage

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

HDFS architecture:

Actual combat:

HDFS is a file system, so it supports the basic operations of the file system, such as the addition, deletion and query of files, the modification of permissions, the creation, deletion and renaming of folders, etc. The operation commands on HDFS are similar to those of linux shell on files, such as ls, mkdir, rm, chown, etc.

Executing bin/hadoop dfs-help commandName when you encounter a problem will show the usage of this command. Define the meaning of the parameter before introducing it:

Italics: indicates the variable path entered by the user: indicates the file name or directory name path. : represents one or more file or directory names file: any file name rc and dest: indicates the source and destination paths of HDFS localSrc and localDest: indicates the source and destination paths of the local file system

7. The parameters in [] are optional

Execute the hadoop fs command as shown in the figure:

Hadoop fs-ls path

List the contents of the path directory, including file name, permissions, owner, size and modification time

Hadoop fs-lsr path

Similar to ls, but recursively displays the contents of the subdirectory

Hadoop fs-du path

Displays the disk usage of all files under path, expressed in bytes, and the file name in full HDFS protocol prefix

Hadoop fs-dus path 2.0: hadoop fs-du-s path

Similar to-du, but it also shows all file or directory disk usage

Hadoop fs-mkdir path

Create a directory called path in HDFS, and if its parent directory does not exist, it will also be created, like mkidr-p in linux

Hadoop fs-rm path

Delete a file or empty directory

Hadoop fs-rmr path 2.x: hadoop fs-rm-r path

Delete a file or recursively delete a directory

Hadoop fs-put localSrc dest

Upload a local file or directory localSrc to the dest path in HDFS

Hadoop fs-copyFromLocal localSrc dest

Same as the-put command

Hadoop fs-moveFromLocal localSrc dest

Upload a file or directory from localSrc to the dest directory in HDFS, and then delete the local file or directory localSrc

Hadoop fs-get [- crc] src localDest

Copy a file or directory from src in HDFS to the local file system localDest

Hadoop fs-getmerge src localDest [addnl]

Merge files that satisfy the path src in HDFS into a file localDest on the local file system

Hadoop fs-cat filename

Display the contents of the file to standard output

Hadoop fs-copyToLocal [- crc] src localDest

Same as the-get command

Hadoop fs-moveToLocal [- crc] src localDest

Similar to the-get command, but when the copy is finished, delete the original file on the HDFS

Hadoop fs-cp src dest

In HDFS, copy the src file or directory to dest

Hadoop fs-setrep [- R] [- w] rep path

Set the number of copies of the target file

Hadoop fs-touchz path

Create a file. The timestamp is the current time and fails if the file already exists, unless the original file is 0.

Hadoop fs-test-[ezd] path

If the path (path) exists, return 1, length 0 (zero), or a directory (directory)

Hadoop fs-stat [format] path

Displays the number of blocks occupied by the file (% b), file name (% n), block size (% n), number of copies (% r), modification time (% y% Y)

Hadoop fs-tail [- f] file

Display the last 1KB content of the file to standard output

Hadoop fs-chmod [- R] [owner] [: [group]] path...

Recursively modify it with the-R parameter. Mode is a 3-bit octal number, or [augo] + /-{rwxX}

Hadoop fs-chgrp [- R] group

Set all groups of a file or directory and use the-R parameter when recursively modifying the directory

For more information, go to the http://hadoop.apache.org/ website.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report