pig安装

1.下载   并解压,放在住文件夹下  pig-0.12.0

2.配置Pig的环境变量

hadoop@master hadoop]$ vim .bashrc

export JAVA_HOME=/usr              --不要写java目录本身,要写上级目录才生效

export JRE_HOME=/usr/java/jre

export PATH=/usr/java/bin:/home/hadoop/hadoop-1.2.1/bin:/home/hadoop/pig-0.12.0/bin:$PATH

--添加hadoop软件命令目录和pig软件命令目录,作用告诉shell命令行到哪个目录下去找命令or程序

export CLASSPATH=./:/usr/java/lib:/usr/java/jre/lib

export PIG_CLASSPATH=/home/hadoop/hadoop-1.2.1/conf      --既然是MapReduce模式,就要让Pig软件找到Hadoop集群,这里是告诉pig软件hadoop的配置文件在哪里,通过一系列配置文件core_site.xml    hdfs-site.xml   mapred-site.xml 可以找到关键参数NameNode 和 JobTracker 的位置以及端口信息,有了这些信息就可以对整个集群进行控制了。
3. $ source  .bashrc   使文件立即生效

4. 将hadoop的conf复制到pig-0.12.0/conf下面,在etc/profile下添加 export PIG_CALSSPATH=/home/hadoop/pig-0.12.0/conf/conf

5. 在根目录下输入pig测试是否成功

Warning: $HADOOP_HOME is deprecated.

2013-10-22 17:30:23,299 [main] INFO  org.apache.pig.Main - Apache Pig version 0.12.0 (r1529718) compiled Oct 07 2013, 12:20:14
2013-10-22 17:30:23,299 [main] INFO  org.apache.pig.Main - Logging error messages to: /home/hadoop/pig-0.12.0/logs/pig_1382434223296.log
2013-10-22 17:30:23,357 [main] INFO  org.apache.pig.impl.util.Utils - Default bootup file /home/hadoop/.pigbootup not found
2013-10-22 17:30:23,799 [main] INFO  org.apache.pig.backend.hadoop.executionengine.HExecutionEngine - Connecting to hadoop file system at: hdfs://master:9000
2013-10-22 17:30:24,490 [main] INFO  org.apache.pig.backend.hadoop.executionengine.HExecutionEngine - Connecting to map-reduce job tracker at: master:9001

如上,则成功!


©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页