In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
./ bin/hdfs dfsadmin -report
http://192.168.209.162:50070/dfshealth.html#tab-overview
You can manipulate directories
http://192.168.209.162:50070/explorer.html#/
Mode 1: Command Line Mode
Hadoop file operation command form is
hadoop fs -cmd
Description: cmd is a specific file operation command, is a variable number of parameters.
Hadoop's most commonly used file manipulation commands include adding files and directories, obtaining files, deleting files, etc.
1 Add files and directories
HDFS has a default working directory/usr/$USER, where $USER is your login username and the author's username is root. This directory cannot be created automatically and needs to be created by executing the mkdir command.
hadoop fs -mkdir /usr/root
Use the Hadoop command put to send the local file README.txt to HDFS.
hadoop fs -put README.txt .
Notice that the last argument to this command is a period (.), This means putting local files into the default working directory, which is equivalent to:
hadoop fs -put README.txt /user/root
2 Getting documents
Obtaining files includes two layers of meaning, one is HDFS obtains files from local files, that is, the added files described above; the other is local files obtain files from HDFS, you can use Hadoop's get command. For example, if the local file does not have a README.txt file and needs to be retrieved from HDFS, you can execute the following command.
hadoop fs -get README.txt .
or
hadoop fs -get README.txt /usr/root/README.txt
3 Delete files
Hadoop delete file command is rm. For example, to delete README.txt uploaded from a local file, execute the following command.
hadoop fs -rm README.txt
4 Retrieving documents
Retrieving a file is to look up the contents of a file in HDFS, using the cat command in hadoop. For example, to view the contents of README.txt, you can execute the following command.
hadoop fs -cat README.txt
In addition, the output of the cat command of hadoop can also be piped to the head of the Unix command:
hadoop fs -cat README.txt | head
Hadoop also supports the tail command to view the last kilobyte. For example, to look up the last kilobyte of README.txt, you can execute the following command.
hadoop fs -tail README.txt
5 See Help
Check out the Hadoop Command Help, which allows us to master and use Hadoop commands well. We can run hadoop fs to get a complete command line for the version of Hadoop we are using, or we can use help to show the usage and short description of a specific command.
For example, to understand the ls command, execute the following command.
hadoop fs -help ls
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.