0% found this document useful (0 votes)
14 views

Lab2_BigData-HDFSp

This lab provides hands-on experience with Hadoop HDFS command-line operations, including navigating and manipulating files and directories. Students will perform tasks such as checking HDFS status, creating directories, uploading data, and managing files using specific HDFS commands. Prerequisites include a basic understanding of Hadoop and a configured HDFS installation.

Uploaded by

bts.nou.waw
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Lab2_BigData-HDFSp

This lab provides hands-on experience with Hadoop HDFS command-line operations, including navigating and manipulating files and directories. Students will perform tasks such as checking HDFS status, creating directories, uploading data, and managing files using specific HDFS commands. Prerequisites include a basic understanding of Hadoop and a configured HDFS installation.

Uploaded by

bts.nou.waw
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Lab2 Big Data

HDFS (Manipulation)

Objective:
The objective of this lab is to provide hands-on experience with Hadoop HDFS (Hadoop Distributed File
System) command-line operations. Students will learn how to navigate, manipulate files and directories, and
perform common tasks using HDFS commands.

Prerequisites:
− Basic understanding of the Hadoop ecosystem.
− Hadoop installation with HDFS configured.
Note :
− Replace <your_username> with your actual Hadoop username.
− Adjust paths based on your specific HDFS setup.
− Ensure that you have the necessary permissions to perform the operations.

Lab Tasks:

1. Check HDFS Status:


Use the following command to check the overall status of HDFS:
hdfs dfsadmin -report

2. Create Directories:
Create a directory named "lab_data" in HDFS:
hdfs dfs -mkdir /user/<your_username>/lab_data

Page 1|2
3. Upload Data:
Upload a local file sample.txt to the "lab_data" directory in HDFS:
hdfs dfs -put /local/path/sample.txt/user/<your_username>/lab_data/

4. List Contents:
List the contents of the "lab_data" directory:
hdfs dfs -ls /user/<your_username>/lab_data

5. Copy Data:
Create a copy of "sample.txt" named "sample_copy.txt" in the same directory:
hdfs dfs -cp /user/<your_username>/lab_data/sample.txt
/user/<your_username>/lab_data/sample_copy.txt

6. View File Content:


View the content of "sample.txt" in HDFS:
hdfs dfs -cat /user/<your_username>/lab_data/sample.txt

sample file:

Page 2|2
Viewing the content of "sample.txt" in HDFS:

7. Move Data:
Move "sample_copy.txt" to a new directory named "backup":
hdfs dfs -mv /user/<your_username>/lab_data/sample_copy.txt
/user/<your_username>/backup/

8. Remove Data:
Remove the "sample.txt" file from HDFS:
hdfs dfs -rm /user/<your_username>/lab_data/sample.txt

9. Recursive Remove:
Remove the entire "backup" directory and its contents:
hdfs dfs -rm -r /user/<your_username>/backup

Page 3|2
10. Check Disk Usage:
Check the disk usage of the HDFS directory:
hdfs dfs -du -h /user/<your_username>

Monitoring
http://localhost:9870

Page 4|2

You might also like