In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to install and use the Pig framework. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
Pig is a framework for computing using mapreduce. Has its own set of syntax Pig latin, can be very convenient to write calculation code.
1. How to use Pig?
After unzipping, modify the file conf/pig.properties and add two lines, as follows:
Fs.default.name=hdfs://hadoop0:9000
Mapred.job.tracker=hadoop0:9001
After saving and exiting, execute bin/pig on the command line.
2. Use pig to complete telecom mobile phone number traffic statistics example:
# loading data in hdfs
The A here is an alias.
A = LOAD'/ Kpi' AS (f _ 0 _ v _ r _ 1 _ L _ 1 _ L _ 2R _ r _ 3R _ r _ r _ 4R _ array)
DUMP A; / / View result A
# filter useful fields in A
B = FOREACH A GENERATE F1, f2, f3, 4
DUMP B; / / View result B
# grouping records in B according to F1
C = GROUP B BY F1
DUMP C; / / View result C
# accumulate the grouped records according to the grouped field
D = FOREACH C GENERATE group, SUM (B.f1), SUM (B.f2), SUM (B.f3)
DUMP D; / / View result D
# Save the final result to HDFS
STORE D INTO'/ out'
3. The above Pig commands can be put into a file. The contents of the execution file are as follows, and the execution method is pig kpi.pig
The content is the same as above.
This is the end of the article on "how to install and use the Pig Framework". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
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.