Pig has two execution modes :
- Local Mode – To run Pig in local mode, you need access to a single machine; all files are installed and run using your local host and file system. Specify local mode using the -x flag (pig -x local).
- MapReduce Mode – To run Pig in MapReduce mode, you need access to a Hadoop cluster and HDFS installation. MapReduce mode is the default mode; you can, but don’t need to, specify it using the -x flag (pig OR pig -x mapreduce).
The pig-0.11.1 installation is done in below versions of Linux and Hadoop respectively.
I have hduser as a dedicated hadoop system user. I had installed my Hadoop in /home/hduser/hadoop folder. Now I am going to install pig in /usr/lib/pig folder.
- Download Pig from here.
- Enter into the directory where the stable version is downloaded. By default it downloads in “Downloads” directory.
$ cd Downloads/
- Unzip the tar file.
$ tar -xvf pig-0.11.1.tar.gz
- Create directory
$ sudo mkdir /usr/lib/pig
- move pig-0.11.1 to pig
$ mv pig-0.11.1 /usr/lib/pig/
- Set the PIG_HOME path in bashrc file
To open bashrc file use this command
$ gedit ~/.bashrc
In bashrc file append the below 2 statements
export PIG_HOME=/usr/lib/pig/pig-0.11.1 export PATH=$PATH:$PIG_HOME/bin
- Restart your computer or use [ . .bashrc]
Now let’s test the installation
On the command prompt type
$ pig -h
It shows the help related to Pig, and its various commands.
- Starting pig in local mode
$ pig -x local grunt>
- Starting pig in mapreduce mode
$ pig -x mapreduce
Note:The information provided here is best of my knowledge and experience if at all any modifications are to be made please help me with your valuable suggestion which are always welcome….