博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
《深入浅出pig系列之中的一个》pig-0.12.0-cdh5.1.2的安装与执行
阅读量:4315 次
发布时间:2019-06-06

本文共 4569 字,大约阅读时间需要 15 分钟。

这里使用的版本号是cdh发行的pig-0.12.0-cdh5.1.2 下载地址点

1.Pig简单介绍:     

Pig是yahoo捐献给apache的一个项目。它是SQL-like语言。是在MapReduce上构建的一种高级查询语言,把一些运算编译进MapReduce模型的Map和Reduce中,而且用户能够定义自己的功能。这是Yahoo开发的又一个克隆Google的项目:Sawzall。

Pig是一个client应用程序,就算你要在Hadoop集群上执行Pig。也不须要在集群上装额外的东西

2.安装

   解压下载完毕的pig到指定文件夹。我这里将其解压到用户hadoop文件夹下

hadoop@caozw:~/pig/conf$ tar -xzvf ~/Downloads/pig-0.12.0-cdh5.1.2.tar.gz  -C ~/
  为配置方便 这里将其建立软链接到pig

hadoop@caozw:~/pig/conf$ ln -s pig-0.12.0-cdh5.1.2/ pig

3.环境变量配置

通过编辑/etc/.profile文件或者是用户文件夹以下的~/.profile文件。我这里编辑hadoop用户文件夹以下的配置文件来配置

export PIG_HOME=/home/hadoop/pigexport PIG_CLASSPATH=${HADOOP_HOME}/etc/hadoopexport PATH=$PATH:$PIG_HOME/bin
当中PIG_CLASSPATH指定了hadoop的配置文件路径。本地模式不要配置,假设须要訪问hadoop的时候必须配置

通过source ~/.profile使配置生效

4.local执行

hadoop@caozw:~/pig/conf$ pig -x local2014-10-13 19:17:34,862 [main] INFO  org.apache.pig.Main - Apache Pig version 0.12.0-cdh5.1.2 (rexported) compiled Aug 25 2014, 19:51:482014-10-13 19:17:34,863 [main] INFO  org.apache.pig.Main - Logging error messages to: /home/hadoop/pig-0.12.0-cdh5.1.2/conf/pig_1413199054861.log2014-10-13 19:17:34,905 [main] INFO  org.apache.pig.impl.util.Utils - Default bootup file /home/hadoop/.pigbootup not found2014-10-13 19:17:35,204 [main] INFO  org.apache.hadoop.conf.Configuration.deprecation - fs.default.name is deprecated. Instead, use fs.defaultFS2014-10-13 19:17:35,205 [main] INFO  org.apache.hadoop.conf.Configuration.deprecation - mapred.job.tracker is deprecated. Instead, use mapreduce.jobtracker.address2014-10-13 19:17:35,206 [main] INFO  org.apache.pig.backend.hadoop.executionengine.HExecutionEngine - Connecting to hadoop file system at: file:///SLF4J: Class path contains multiple SLF4J bindings.SLF4J: Found binding in [jar:file:/home/hadoop/hadoop-2.3.0-cdh5.1.2/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]SLF4J: Found binding in [jar:file:/home/hadoop/hbase-0.98.1-cdh5.1.2/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]2014-10-13 19:17:35,732 [main] WARN  org.apache.hadoop.util.NativeCodeLoader - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable2014-10-13 19:17:35,918 [main] INFO  org.apache.hadoop.conf.Configuration.deprecation - io.bytes.per.checksum is deprecated. Instead, use dfs.bytes-per-checksum2014-10-13 19:17:35,922 [main] INFO  org.apache.hadoop.conf.Configuration.deprecation - fs.default.name is deprecated. Instead, use fs.defaultFSgrunt> 
出现grunt提示说明启动成功

5.hadoop执行

须要启动hadoop集群,pig会依据PIG_CLASSPATH的路径以下的配置文件自己主动识别hadoop集群

grunt> hadoop@caozw:~/pig/conf$ pig 2014-10-13 19:18:36,511 [main] INFO  org.apache.pig.Main - Apache Pig version 0.12.0-cdh5.1.2 (rexported) compiled Aug 25 2014, 19:51:482014-10-13 19:18:36,511 [main] INFO  org.apache.pig.Main - Logging error messages to: /home/hadoop/pig-0.12.0-cdh5.1.2/conf/pig_1413199116510.log2014-10-13 19:18:36,541 [main] INFO  org.apache.pig.impl.util.Utils - Default bootup file /home/hadoop/.pigbootup not found2014-10-13 19:18:36,849 [main] INFO  org.apache.hadoop.conf.Configuration.deprecation - mapred.job.tracker is deprecated. Instead, use mapreduce.jobtracker.address2014-10-13 19:18:36,849 [main] INFO  org.apache.hadoop.conf.Configuration.deprecation - fs.default.name is deprecated. Instead, use fs.defaultFS2014-10-13 19:18:36,849 [main] INFO  org.apache.pig.backend.hadoop.executionengine.HExecutionEngine - Connecting to hadoop file system at: hdfs://192.168.118.168:9100SLF4J: Class path contains multiple SLF4J bindings.SLF4J: Found binding in [jar:file:/home/hadoop/hadoop-2.3.0-cdh5.1.2/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]SLF4J: Found binding in [jar:file:/home/hadoop/hbase-0.98.1-cdh5.1.2/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]2014-10-13 19:18:37,071 [main] WARN  org.apache.hadoop.util.NativeCodeLoader - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable2014-10-13 19:18:38,379 [main] INFO  org.apache.hadoop.conf.Configuration.deprecation - fs.default.name is deprecated. Instead, use fs.defaultFSgrunt> 
至此安装已经完毕了。安装非常easy可是功能不简单,使用会在后面一步步展开。而且能够使用pig为hdfs的数据建索引并推送到elasticsearch集群中。非常期待

转载于:https://www.cnblogs.com/yfceshi/p/6789100.html

你可能感兴趣的文章
an exciting trip
查看>>
【转】xmind8 破解激活教程
查看>>
Mysql用命令方式启动服务
查看>>
【贪心】codeforces A. Heidi and Library (easy)
查看>>
【leetcode】lower_bound
查看>>
跨站请求伪造(CSRF)
查看>>
EF Code First数据库映射规则及配置
查看>>
.Net StackFrame
查看>>
Qt 学习之路:视图选择 (QItemSelectionModel)
查看>>
QStyleFactory类参考
查看>>
linux 获取系统屏幕分辨率
查看>>
MySQL 数据库常用命令小结
查看>>
log4net使用记录
查看>>
The Django Book 2.0--中文版
查看>>
编译式安装MYSQL
查看>>
更快找到正确的机器学习算法
查看>>
pair work 附加题解法(张艺 杨伊)
查看>>
记录我发现的第一个关于 Google 的 Bug
查看>>
linq操作符:转换操作符
查看>>
ng-深度学习-课程笔记-2: 神经网络中的逻辑回归(Week2)
查看>>