In terms of starting Pig, it can be started in 2 modes –
In Local Mode:
1) Files are referenced from the Local File System.
2) No need of Hadoop or HDFS .
3) Used mainly for Testing and Debugging purposes.
4) It is started by:pig -x local
In MapReduce Mode:
1) Files are referenced from HDFS (in localhost or remote cluster)
2) Each PigLatin statement is broken down into a series of MapReduce jobs in the background.
3) Used for Production run.
4) It is started by:pig -x mapreduce
or simplypig
In terms of Executing Pig Scripts, they can be executed in 2 modes –
- Interactive Mode
- Batch Mode.
In Interactive Mode a user can start Grunt Shell by executing the commandpig
orpig -x local
and can run Pig Latin statements in the shell.
In Batch Mode a user can save the Pig statements in a single file (usually saved with .pig extension) and then run the file aspig file.pig