Hadoop (HDFS) Distributed File System basic operations

Source: Internet
Author: User
Tags file system hadoop fs

Hadoop HDFs provides a set of command sets to manipulate files, either to manipulate the Hadoop Distributed file system or to manipulate the local file system. But to add theme (Hadoop file system with hdfs://, local file system with file://)

1. Add Files, directories

HDFs file System (required plus hdfs://):

Because we've configured Fs.default.name in Core-site.xml.

So all orders to deal with HDFs don't need to be prefixed hdfs://192.168.129.35:9000

For example, if we want to create a directory called/user/hadoop-user in the Hadoop file system, then

Hadoop Fs-mkdir/user/hadoop-user

To view the directory we created,

Hadoop Fs-ls/

or using a Hadoop FS-LSR/recursive display subdirectory

Local file system (requires file://):

For example, to view the/tmp/charles directory of the Linux local file system:

2. Mobile Copy files, directories

If we want to copy a file from the local file system to HDFs:

For example, we have a file called Textfile.txt in the/tmp/charles directory, so we want to upload it to the/user/hadoop-user directory we just created in HDFs:

Hadoop Fs-put/tmp/charles/textfile.txt/user/hadoop-user

We use Hadoop fs-ls to see if this file has been added:

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.