Apache Pig execution mechanisms
1) A machine with Ubuntu 14.04 LTS operating system
2) Apache Hadoop 2.6.4 pre installed (How to install Hadoop on Ubuntu 14.04)
3) Apache Pig pre installed (How to install Pig on Ubuntu 14.04)
Pig Execution Mechanism
You can run Apache Pig in two modes, namely, Local Mode and MapReduce mode.
Step 1 - Change the directory to /usr/local/pig/bin
Step 2 - Enter into grunt shell in local mode.
Step 3 - Enter into grunt shell in MapReduce mode.
Step 4 - Create a employee.txt file.
Step 5 - Add these following lines to employee.txt file.
Step 6 - Create a sample pig script.
Step 7 - Add these following lines to sample_script.pig. Save and close.
Step 8 - Change the directory to /usr/local/pig/bin
Step 9 - Run the sample_script.pig In my case, the sample_script.pig script is saved in /home/hduser/Desktop/PIG/ directory.
Step 10 - Copy employee.txt from local file system to HDFS. In my case, the employee.txt file is stored in /home/hduser/Desktop/ directory.
Step 11 - Create a sample pig script.
Step 12 - Add these following lines to sample_script.pig. Save and close.
Step 13 - Run the sample_script.pig In my case, the sample_script.pig script is saved in /home/hduser/Desktop/PIG/ directory.
Please share this blog post and follow me for latest updates on
Labels : Pig Installation Pig GRUNT Shell Usage Pig Load and Store Operations Pig Diagnostic Operators Pig Group Example Pig Join Example Pig Cross Example Pig Union Example Pig Split Example Pig Filter Example Pig Distinct Example Pig Foreach Example Pig OrderBy Example Limit Example Pig Eval Functions Example Pig BagToString Example Pig Concat Example Pig Tokenize Example Pig UDF's Java Example Pig SCRIPT