Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Pig Wiki" for change 
notification.

The following page has been changed by CorinneC:
http://wiki.apache.org/pig/RunPig

------------------------------------------------------------------------------
  
  (1) With the Pig Script
  
- From your local directory, run:
+ From your current working directory, run:
  {{{
  $ pig -x local
  }}}
@@ -158, +158 @@

  This section shows you how to run Pig in hadoop (mapreduce) mode. To run Pig 
in Hadoop mode, you need access to a Hadoop cluster. 
  
  === Grunt Shell ===
+ To run Pig’s Grunt shell in hadoop (mapreduce) mode, follow these 
instructions. 
+ 
+ Note: When you begin the session, Pig will allocate a 15-node cluster. When 
you quit the session, Pig will automatically deallocate the nodes.
+ 
+ From your current working directory, run:
+ {{{
+ $ pig
+ }}}
+ 
+ The Grunt shell is invoked and you can enter commands at the prompt.
+ {{{
+ grunt> A = load 'passwd' using PigStorage(':'); 
+ grunt> B = foreach A generate $0; 
+ grunt> dump B; 
+ }}}
+ 
+ 
  
  === Script File ===
+ To run Pig script files in hadoop (mapreduce) mode, follow these instructions 
(which are the same as the Grunt Shell instructions above – you just include 
the script file).
+ 
+ Note: Again, Pig will automatically allocate and deallocate a 15-node cluster.
+ 
+ From your current working directory, run:
+ {{{
+ $ pig XXX.pig
+ }}}
+ 
+ The results are displayed  to your terminal screen.
+ 
  
  === Embedded Program ===
+ To compile and run an embedded Java/Pig program in hadoop (mapreduce) mode, 
follow these instructions. 
  
+ First, point $HADOOPDIR to the directory that contains the hadoop-site.xml 
file. 
+ 
+ From your current working directory, compile the program:
+ {{{
+ $ javac -cp pig.jar idhadoop.java
+ }}}
+ 
+ Note: XXX.class is written to your current working directory. Include “.” 
in the class path when you run the program.
+ 
+ From your current working directory, run the program:
+ {{{
+ Unix:   $ java -cp pig.jar:.:$HADOOPDIR XXX
+ Cygwin: $ java –cp ‘.;pig.jar;$HADOOPDIR’ XXX
+ }}}
+ 
+ To view the results, check the idout directory on your Hadoop system.
+ 

Reply via email to