Tutorial 02_ familiar with commonly used HDFS operations

Source: Internet
Author: User

Shell Command implementation:

(1) Upload any text file to HDFs, if the specified file already exists in HDFs, the user specifies whether to append to the end of the original file or overwrite the original file;

(2) Download the specified file from HDFS and automatically rename the downloaded file if the local file has the same name as the file to be downloaded;

(3) Output The contents of the specified file in HDFS to the terminal;

(4) display The read-write permission, size, creation time, path and other information of the file specified in HDFS;

(5) given a directory in HDFS, output the read-write permission, size, creation time, path of all the files in the directory, and if the file is a directory, recursively output all the file-related information in that directory;

(6) provide a path to the file within HDFS to create and delete the file. If the file is in a directory that does not exist, the directory is created automatically;

(7) When the directory is deleted, the user specifies whether the directory is also deleted when the directory is not empty;

(8) append content to the file specified in HDFS, appended by user-specified content to the beginning or end of the original file;

(9) Delete The files specified in HDFS;

in HDFS, move the file from the source path to the destination path.

(ii) programming to implement a class "Myfsdatainputstream", which inherits "Org.apache.hadoop.fs.FSDataInputStream", requires the following: To implement the method of reading the specified file in HDFs by row " ReadLine () ", if read to the end of the file, returns NULL, otherwise returns the text of the file line.

(iii) viewing the Java Help manual or other materials, programming with "Java.net.URL" and "org.apache.hadoop.fs.FsURLStreamHandlerFactory" to complete the output HDFs Specifies the text of the file in the terminal.

Tutorial 02_ familiar with commonly used HDFS operations

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.