In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces what are the basic operations of Hadoop. It is very detailed and has a certain reference value. Friends who are interested must finish it!
Let's start with a rough description of the difference between "hadoop fs" and "hadoop dfs": fs is a relatively abstract level. In a distributed environment, fs is dfs, but in a local environment, fs is local file system, and dfs is not available.
1. List the HDFS files:
Hadoop fs-ls
A)-if nothing is followed by ls, list the contents under the "/ user/ username /" directory of HDFS
B) if you want to list the contents of a folder,-ls is followed by the path to the folder, such as listing the contents of the input:
Hadoop fs-ls input
2. Create a folder in HDFS:
Name of the hadoop fs-mkdir folder
For example:
Hadoop fs-mkdir input
3. Delete files or folders in HDFS
Hadoop fs-rmr folder name or file name
4. Upload files to HDFS:
Hadoop fs-put ~ / file test
Upload the file file from this machine to HDFS and rename it to test.
If you want to upload to a folder, change test to the address of the folder. At this point, the name of the uploaded file will not change, such as the local file.
Upload the file test1.txt,test2.txt,test3.txt in test to input in HDFS:
Hadoop fs-put ~ / test/test*.txt input
5. View a file under HDFS:
Hadoop fs-cat file path
For example, view the contents of the test file in input:
Hadoop fs-cat input/test
6. Copy the files in HDFS to the local system:
Filename in hadoop fs-get HDFS filename local storage address in local system
For example: copy the output file in HDFS to the local system Documents folder
Hadoop fs-get output / home/kevin/Documents/
7. Enter / exit safe mode
Sometimes, operations such as creating and deleting files cannot be carried out on the file system when hadoop is started. At this time, the state of the file system is called safe mode, and you can search the Internet for its use. the author will not repeat it here (because the author is a beginner, there are not many things on HDFS and there are not many nodes, so the author generally turns on Hadoop, regardless of whether it is in safe mode or not. Enter the command to exit safe mode first.
Hadoop dfsadmin-safemode enterhadoop dfsadmin-safemode leave above are all the contents of this article entitled "what are the basic Operations in Hadoop". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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.