/    /  Pig – Installation and Running

Pig – Installation and Running:

Pig installation is very easy in Hadoop cluster, just we need to install a stable release from pig official site and unpack the tarball in a suitable place of your workstation.

% tar xzf pig-x.y.z.tar.gz

After untar, if we have set the Hadoop_home and path variables no need to do any extra work in Pig, just go to pig local directory and execute bin/pig the grunt shell will be started.

Running Pig Programs:

We can execute Pig programs in 3 ways,

  1. Script – We can use the scripts to run pig programs. It runs the commands in the local file script.pig. For very short scripts we can use ‘-e’ options to run pig scripts.
  2. Grunt – It is an interactive shell to execute pig commands. It is started when no file is specified to run and ‘-e’ option is not used. We can also execute the scripts in grunt using run and exec.
  3. Embedded – We can run pig programs in java using PigServer class. For programmatic access to Grunt use PigRunner.

Note – We can use the above 3 ways in both local and MapReduce mode.