In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article focuses on "how to create hadoop hdfs and MapReduce". Friends who are interested may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to create hadoop hdfs and MapReduce.
The general steps are as follows:
Create a new file test.txt with the content
Hello Hadoop
Hello xiaoqiang
Hello testingbang
Hello http://xqtesting.sxl.cn
Upload test.txt to the root directory of hdfs
/ usr/lib/hadoop/hadoop-2.7.4/bin/hdfs dfs-put / root/install/test.txt /
Then the browser can see the file you just uploaded, as shown in the following figure
Run an official wordcount program to count the number of characters, with the following command:
/ usr/lib/hadoop/hadoop-2.7.4/bin/hadoop jar / usr/lib/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.4.jar wordcount hdfs://localhost:9000/test.txt hdfs://localhost:9000/out
Explain this command, which roughly means that you use hadoop to execute a wordcount method called hadoop-mapreduce-examples-2.7.4.jar, where the input parameter is the test.txt file of the root directory on hdfs, and the output path is hdfs and the out directory under the directory.
PS: I didn't configure hadoop as an environment variable here, so the command is very long, so you can configure it, so the command will be much shorter. As for how to configure it, you can understand it yourself.
The execution process is as follows:
After the execution is complete, refresh the browser again to see the out directory and results.
Click part-r-00000 and click download on the pop-up page
At this time, the download will appear 404, we just need to change the localhost in URL to your server's ip address to download it. After downloading, open it with an editor. The content is as follows:
PS: you can also view it with the command, as shown in the following figure
At this point, I believe you have a deeper understanding of "how to create hadoop hdfs and MapReduce". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.