1.首先你需要Hadoop集群,看这里:
http://blog.csdn.net/a237428367/article/details/50462858
2.tar -zxvf pig-0.15.0.tar.gz 你懂的
3. vi /etc/profile 环境变量
如果是本地模式则只需
export PIG_HOME=/hadoop/pig-0.15.0
MapReduce模式则再加上
export PIG_CLASSPATH=${HAOOP_HOME}/conf/
4. ./pig 进入grunt shell
16/01/06 16:41:23 INFO pig.ExecTypeProvider: Trying ExecType : LOCAL 16/01/06 16:41:23 INFO pig.ExecTypeProvider: Trying ExecType : MAPREDUCE 16/01/06 16:41:23 INFO pig.ExecTypeProvider: Picked MAPREDUCE as the ExecType 2016-01-06 16:41:23,285 [main] INFO org.apache.pig.Main - Apache Pig version 0.15.0 (r1682971) compiled Jun 01 2015, 11:44:35 2016-01-06 16:41:23,285 [main] INFO org.apache.pig.Main - Logging error messages to: /hadoop/pig-0.15.0/bin/pig_1452069683283.log 2016-01-06 16:41:23,319 [main] INFO org.apache.pig.impl.util.Utils - Default bootup file /root/.pigbootup not found 2016-01-06 16:41:23,712 [main] INFO org.apache.hadoop.conf.Configuration.deprecation - mapred.job.tracker is deprecated. Instead, use mapreduce.jobtracker.address 2016-01-06 16:41:23,712 [main] INFO org.apache.hadoop.conf.Configuration.deprecation - fs.default.name is deprecated. Instead, use fs.defaultFS 2016-01-06 16:41:23,712 [main] INFO org.apache.pig.backend.hadoop.executionengine.HExecutionEngine - Connecting to hadoop file system at: hdfs://master:9000 2016-01-06 16:41:24,292 [main] INFO org.apache.hadoop.conf.Configuration.deprecation - mapred.job.tracker is deprecated. Instead, use mapreduce.jobtracker.address 2016-01-06 16:41:24,292 [main] INFO org.apache.pig.backend.hadoop.executionengine.HExecutionEngine - Connecting to map-reduce job tracker at: http://master:9001 2016-01-06 16:41:24,293 [main] INFO org.apache.hadoop.conf.Configuration.deprecation - fs.default.name is deprecated. Instead, use fs.defaultFS grunt>
5. quit; 退出shell(记得带分号)
完毕.