SlideShare a Scribd company logo
1 of 18
Big data analytics
Practical No. 06 To use Pig in Hadoop local mode and Map-reduce
mode.
Name: Sanket Patel
Apache Pig is a data manipulation tool that is built over Hadoop’s
MapReduce. Pig provides us with a scripting language for easier and
faster data manipulation. This scripting language is called Pig Latin.
Apache Pig scripts can be executed in 3 ways as follows:
 Using Grunt Shell (Interactive Mode) – Write the commands in the
grunt
shell and get the output there itself using the DUMP command.
 Using Pig Scripts (Batch Mode) – Write the pig latin commands in a
single
file with .pig extension and execute the script on the prompt.
 Using User-Defined Functions (Embedded Mode) – Write your own
Functions on languages like Java and then use them in the scripts.
 Pig Installation:
Before proceeding you need to make sure that you have
all these pre-requisites as follows.
 Hadoop Ecosystem installed on your system and all the
four components i.e. DataNode, NameNode,
ResourceManager, TaskManager are working. If any one
of them randomly shuts down then you need to fix
that before proceeding.
 7-Zip is required to extract the .tar.gz files in
windows.
Let’s take a look at How to install Pig version (0.17.0) on
Windows as follows.
 Step 1: Download the Pig version 0.17.0 tar file from the
official Apache pig site. Navigate to the website
https://downloads.apache.org/pig/latest/. Download the
file ‘pig-0.17.0.tar.gz’ from the website.
Then extract this tar file using 7-Zip tool (use 7-Zip for faster
extraction. First we extract the .tar.gz file by right-clicking on
it and clicking on ‘7-Zip → Extract Here’. Then we extract the
.tar file in the same way). To have the same paths as you can
see in the diagram then you need to extract in the C: drive.
Step 2: Add the path variables of PIG_HOME and PIG_HOMEbin
Click the Windows Button and in the search bar type ‘Environment
Variables’. Then click on the ‘Edit the system environment variables’.
Then Click on ‘Environment Variables’ on the bottom of the tab. In
the newly opened tab click on the ‘New’ button in the user variables
section.
After hitting new Add the following values in the fields.
Variable Name - PIG_HOME
Variable value - C:pig-0.17.0
Now click on the Path variable in the System variables. This will open a
new tab. Then click the ‘New’ button. And add the value C:pig-
0.17.0bin in the text box. Then hit OK until all tabs have closed.
Step 3: Correcting the Pig Command File
Find file ‘pig.cmd’ in the bin folder of the pig file ( C:pig-0.17.0bin)
Find the line:
set HADOOP_BIN_PATH=%HADOOP_HOME%bin
Replace this line by:
set HADOOP_BIN_PATH=%HADOOP_HOME%libexec
And save this file. We are finally here. Now you are all set to start
exploring Pig and it’s environment.
There are 2 Ways of Invoking the grunt shell:
Local Mode: All the files are installed, accessed, and run in the
local machine itself. No need to use HDFS. The command for
running Pig in local mode is as follows.
“pig -x local”
MapReduce Mode: The files are all present on the HDFS . We need to
load this data to process it. The command for running Pig in
MapReduce/HDFS Mode is as follows.
“pig -x mapreduce”
Practical%2006%20Big%20data%20analytics.pptx

More Related Content

Similar to Practical%2006%20Big%20data%20analytics.pptx

Sublime text-gdg-algiers-2015
Sublime text-gdg-algiers-2015Sublime text-gdg-algiers-2015
Sublime text-gdg-algiers-2015ismnoiet
 
SH 1 - SES 6 - compass-tel-aviv-slides.pptx
SH 1 - SES 6 - compass-tel-aviv-slides.pptxSH 1 - SES 6 - compass-tel-aviv-slides.pptx
SH 1 - SES 6 - compass-tel-aviv-slides.pptxMongoDB
 
Consuming and Publishing Ordnance Survey Open Data with Open Source Software
Consuming and Publishing Ordnance Survey Open Data with Open Source SoftwareConsuming and Publishing Ordnance Survey Open Data with Open Source Software
Consuming and Publishing Ordnance Survey Open Data with Open Source SoftwareJoanne Cook
 
fileop report
fileop reportfileop report
fileop reportJason Lu
 
PurposeThe purpose of this project is to provide non-trivial .docx
PurposeThe purpose of this project is to provide non-trivial .docxPurposeThe purpose of this project is to provide non-trivial .docx
PurposeThe purpose of this project is to provide non-trivial .docxmakdul
 
Installing Python on Windows OS
Installing Python on Windows OSInstalling Python on Windows OS
Installing Python on Windows OSWei-Wen Hsu
 
Getting Started with the Ribbon library - MUGUKI User Group Meeting 2016
Getting Started with the Ribbon library - MUGUKI User Group Meeting 2016Getting Started with the Ribbon library - MUGUKI User Group Meeting 2016
Getting Started with the Ribbon library - MUGUKI User Group Meeting 2016Peter Horsbøll Møller
 
Installation of Drupal on Windows XP
Installation of Drupal on Windows XPInstallation of Drupal on Windows XP
Installation of Drupal on Windows XPRupesh Kumar
 
Python Requirements File How to Create Python requirements.txt
Python Requirements File How to Create Python requirements.txtPython Requirements File How to Create Python requirements.txt
Python Requirements File How to Create Python requirements.txtInexture Solutions
 
Darkroom 2 lightroom and photoshop actions and plugins
Darkroom 2 lightroom and photoshop actions and pluginsDarkroom 2 lightroom and photoshop actions and plugins
Darkroom 2 lightroom and photoshop actions and pluginsdaviddiener
 
Instructions for using the phase wrapping and unwrapping code
Instructions for using the phase wrapping and unwrapping codeInstructions for using the phase wrapping and unwrapping code
Instructions for using the phase wrapping and unwrapping codeImperial College, London
 

Similar to Practical%2006%20Big%20data%20analytics.pptx (20)

Sublime text-gdg-algiers-2015
Sublime text-gdg-algiers-2015Sublime text-gdg-algiers-2015
Sublime text-gdg-algiers-2015
 
SH 1 - SES 6 - compass-tel-aviv-slides.pptx
SH 1 - SES 6 - compass-tel-aviv-slides.pptxSH 1 - SES 6 - compass-tel-aviv-slides.pptx
SH 1 - SES 6 - compass-tel-aviv-slides.pptx
 
Sandy Report
Sandy ReportSandy Report
Sandy Report
 
Sandy Report
Sandy ReportSandy Report
Sandy Report
 
Oracle applications 11i dba faq
Oracle applications 11i dba faqOracle applications 11i dba faq
Oracle applications 11i dba faq
 
Consuming and Publishing Ordnance Survey Open Data with Open Source Software
Consuming and Publishing Ordnance Survey Open Data with Open Source SoftwareConsuming and Publishing Ordnance Survey Open Data with Open Source Software
Consuming and Publishing Ordnance Survey Open Data with Open Source Software
 
fileop report
fileop reportfileop report
fileop report
 
Mp lab manual
Mp lab manualMp lab manual
Mp lab manual
 
PurposeThe purpose of this project is to provide non-trivial .docx
PurposeThe purpose of this project is to provide non-trivial .docxPurposeThe purpose of this project is to provide non-trivial .docx
PurposeThe purpose of this project is to provide non-trivial .docx
 
Installing Python on Windows OS
Installing Python on Windows OSInstalling Python on Windows OS
Installing Python on Windows OS
 
Getting Started with the Ribbon library - MUGUKI User Group Meeting 2016
Getting Started with the Ribbon library - MUGUKI User Group Meeting 2016Getting Started with the Ribbon library - MUGUKI User Group Meeting 2016
Getting Started with the Ribbon library - MUGUKI User Group Meeting 2016
 
Sap pandit !!
Sap pandit !!Sap pandit !!
Sap pandit !!
 
Data Forensics Tool
Data Forensics ToolData Forensics Tool
Data Forensics Tool
 
Installation of Drupal on Windows XP
Installation of Drupal on Windows XPInstallation of Drupal on Windows XP
Installation of Drupal on Windows XP
 
Pig
PigPig
Pig
 
Python Requirements File How to Create Python requirements.txt
Python Requirements File How to Create Python requirements.txtPython Requirements File How to Create Python requirements.txt
Python Requirements File How to Create Python requirements.txt
 
Darkroom 2 lightroom and photoshop actions and plugins
Darkroom 2 lightroom and photoshop actions and pluginsDarkroom 2 lightroom and photoshop actions and plugins
Darkroom 2 lightroom and photoshop actions and plugins
 
Instructions for using the phase wrapping and unwrapping code
Instructions for using the phase wrapping and unwrapping codeInstructions for using the phase wrapping and unwrapping code
Instructions for using the phase wrapping and unwrapping code
 
Applications lab
Applications lab Applications lab
Applications lab
 
Front end development gurant
Front end development gurantFront end development gurant
Front end development gurant
 

Recently uploaded

Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGSIVASHANKAR N
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 

Recently uploaded (20)

Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 

Practical%2006%20Big%20data%20analytics.pptx

  • 1. Big data analytics Practical No. 06 To use Pig in Hadoop local mode and Map-reduce mode. Name: Sanket Patel
  • 2. Apache Pig is a data manipulation tool that is built over Hadoop’s MapReduce. Pig provides us with a scripting language for easier and faster data manipulation. This scripting language is called Pig Latin. Apache Pig scripts can be executed in 3 ways as follows:  Using Grunt Shell (Interactive Mode) – Write the commands in the grunt shell and get the output there itself using the DUMP command.  Using Pig Scripts (Batch Mode) – Write the pig latin commands in a single file with .pig extension and execute the script on the prompt.  Using User-Defined Functions (Embedded Mode) – Write your own Functions on languages like Java and then use them in the scripts.
  • 3.  Pig Installation: Before proceeding you need to make sure that you have all these pre-requisites as follows.  Hadoop Ecosystem installed on your system and all the four components i.e. DataNode, NameNode, ResourceManager, TaskManager are working. If any one of them randomly shuts down then you need to fix that before proceeding.  7-Zip is required to extract the .tar.gz files in windows. Let’s take a look at How to install Pig version (0.17.0) on Windows as follows.
  • 4.  Step 1: Download the Pig version 0.17.0 tar file from the official Apache pig site. Navigate to the website https://downloads.apache.org/pig/latest/. Download the file ‘pig-0.17.0.tar.gz’ from the website. Then extract this tar file using 7-Zip tool (use 7-Zip for faster extraction. First we extract the .tar.gz file by right-clicking on it and clicking on ‘7-Zip → Extract Here’. Then we extract the .tar file in the same way). To have the same paths as you can see in the diagram then you need to extract in the C: drive.
  • 5.
  • 6. Step 2: Add the path variables of PIG_HOME and PIG_HOMEbin Click the Windows Button and in the search bar type ‘Environment Variables’. Then click on the ‘Edit the system environment variables’. Then Click on ‘Environment Variables’ on the bottom of the tab. In the newly opened tab click on the ‘New’ button in the user variables section. After hitting new Add the following values in the fields. Variable Name - PIG_HOME Variable value - C:pig-0.17.0
  • 7.
  • 8. Now click on the Path variable in the System variables. This will open a new tab. Then click the ‘New’ button. And add the value C:pig- 0.17.0bin in the text box. Then hit OK until all tabs have closed.
  • 9. Step 3: Correcting the Pig Command File Find file ‘pig.cmd’ in the bin folder of the pig file ( C:pig-0.17.0bin) Find the line: set HADOOP_BIN_PATH=%HADOOP_HOME%bin Replace this line by: set HADOOP_BIN_PATH=%HADOOP_HOME%libexec And save this file. We are finally here. Now you are all set to start exploring Pig and it’s environment.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15. There are 2 Ways of Invoking the grunt shell: Local Mode: All the files are installed, accessed, and run in the local machine itself. No need to use HDFS. The command for running Pig in local mode is as follows. “pig -x local”
  • 16.
  • 17. MapReduce Mode: The files are all present on the HDFS . We need to load this data to process it. The command for running Pig in MapReduce/HDFS Mode is as follows. “pig -x mapreduce”