Hdfs Lab Work
Hdfs Lab Work
Lab Work
1 Lab Exercises:
1.1 Exercise 1:
a. Create a file called students.txt with the following data:
Emp #,Name,Score
1000,John Doe,12
1001,Jane Doe,14
1002,Jill Doe,17
1003,John Smith,16
1004,Jill Smith,18
1005,Tim Ford,17
1006,Tom Ford,15
1007,Bill Smith,14
1008,John Ford,16
1009,Chuck Jones,14
1010,Chad Smith,17
b. Type the below command in the working directory to view the HDFS path:
hadoop fs –ls / (HDFS root directory)
hadoop fs –ls /user/xxxx/ (current user directory)
or
hadoop fs -cat lab/xxxx/students.txt
Page No. 1
1.2 Exercise 2:
here instead of -rmr, we can use -rmdir to remove the entire directory
or
-Execute command.
hadoop jar wordcount.jar WordCount E0_lab/<emp_id>/wordcount_input.txt lab/xxxx/wordcount_output
or
yarn jar wordcount.jar WordCount lab/xxxx/wordcount_input.txt lab/xxxx/wordcount_output
-View the contents of the wordcount output file
hadoop fs -cat lab/xxxx/wordcount_output/part-*
Page No. 2