Practical 2 Hadoop Distributed File System (HDFS)
Practical 2 Hadoop Distributed File System (HDFS)
hduser@PC25:~$ jps
2112 Jps
1696 NodeManager
1542 ResourceManager
1114 SecondaryNameNode
876 DataNode
685 NameNode
FYI only, the following actions have already been completed in the distro:
# Create the directories named user and tmp in the distributed file system:
# The /user directory is where all Hadoop users’ home directories will be created later on.
hduser@PC25:~$ hdfs dfs -mkdir /user
hduser@PC25:~$ hdfs dfs -mkdir /tmp
5.2. Download the shakespeare.txt file from Google Drive into your local file
system (Ubuntu 22.04)
student@PC25:~$ wget --no-check-certificate
'https://docs.google.com/uc?
export=download&id=122PnuKaSaA_OyYOKnxQOdlMc5awdyf5v' -O
shakespeare.txt
5.3. Copy the downloaded file shakespeare.txt from the local file system to HDFS
student@PC25:~$ hdfs dfs -put shakespeare.txt shakespeare.txt
5.4. Read the contents of the file in HDFS using the cat command, and then pipe the
output to less in order to view the contents of the remote file.
student@PC25:~$ hdfs dfs -cat shakespeare.txt | less
Note: use the arrow keys to navigate the file. Type q to quit.
5.5. Copy the file from HDFS to the local file system and rename it as shakespeare-
dfs.txt.
student@PC25:~$ hdfs dfs -get shakespeare.txt ./shakespeare-
dfs.txt
💡 Remember to confirm that the above action is successful.