编译hive2.3.2源码并搭建环境


【转载请注明出处】:https://www.jianshu.com/p/e559746a6568

1. 安装环境说明

(1)hive1.2之后需要java1.7或者更高的版本,建议用1.8;

(2)hadoop版本2.x以上,hive2.0.0之后不再支持1.x;

在本文之前,hadoop环境已经安装,具体可见文章《编译hadoop2.9源码并搭建环境》

2. 下载并编译hive源码

官网地址

我选择的是当前的稳定版2.3.2

解压到安装目录,进入源码目录之后执行编译命令

mvn clean package -Pdist -DskipTests

编译完成

编译hive2.3.2源码并搭建环境_第1张图片

编译时遇到的问题总结

2.1 缺少jar包pentaho-aggdesigner-algorithm:jar

编译hive2.3.2源码并搭建环境_第2张图片

给编译失败的这个项目的pom.xml添加下面的仓库或者添加maven的mirror

    

                true

                always

                warn

   

    conjars

    Conjars

    http://conjars.org/repo

    default

 

    conjars

    Conjars

    http://conjars.org/repo

    *

如果依然无法下载那就手动下载pentaho-aggdesigner-algorithm-5.1.5-jhyde.jar然后添加到本地maven仓库

mvn install:install-file -Dfile=/Users/zl/Downloads/pentaho-aggdesigner-algorithm-5.1.5-jhyde.jar -DgroupId=org.pentaho -DartifactId=pentaho-aggdesigner-algorithm -Dversion=5.1.5-jhyde -Dpackaging=jar

2.2 缺少jar包javax.jms:jms:jar:1.1

编译hive2.3.2源码并搭建环境_第3张图片

这个包在中央仓库确实是没有的,但是在jboss仓库里面有,可以采用同样的处理方式

https://repository.jboss.org/nexus/content/repositories/thirdparty-releases/

手动下载地址

3. 搭建环境

编译完的安装包在目录packaging/target下

编译hive2.3.2源码并搭建环境_第4张图片

配置文件全部在conf目录下

(1) 修改配置文件hive-site.xml

mv hive-default.xml.template hive-site.xml

将${system:java.io.tmpdir}全部换成/work/data/hive_data/tmp

将${system:user.name}全部替换成自己的用户名

hive.metastore.warehouse.di=/work/data/hive_data/warehouse

datanucleus.schema.autoCreateAll=true

hive.metastore.schema.verification=false

下面两个是非必须的,只是为了一次性修改好,以后用的话直接用

hive.repl.rootdir的值修改为/work/data/hive_data/repl_rootdir

hive.repl.cmrootdir的值修改为/work/data/hive_data/repl_cmrootdir

(2)hive-log4j2.properties

mv hive-log4j2.properties.template hive-log4j2.properties

hive默认使用Derby数据库,基于Derby数据库的配置已经完成,本文使用mysql数据库,配置继续hive-site.xml文件

javax.jdo.option.ConnectionURL=jdbc:mysql://localhost:3306/hive?useUnicode=true&characterEncoding=utf8&autoReconnect=true&rewriteBatchedStatements=true&useSSL=false

javax.jdo.option.ConnectionDriverName=com.mysql.jdbc.Driver

javax.jdo.option.ConnectionUserName=hive

javax.jdo.option.ConnectionPassword=123qwe

下载mysql-connector-java

下载地址:https://cdn.mysql.com//Downloads/Connector-J/mysql-connector-java-5.1.45.zip

解压得到mysql-connector-java-5.1.45.jar,拷贝到hive的lib目录下

启动Hive 的 Metastore Server服务进程

hive --service metastore &

问题1:metastore.sh: line 29: export: ` -Dproc_metastore  not a valid identifier

查看这个脚本发现=号后面多了一个空格,去掉即可

编译hive2.3.2源码并搭建环境_第5张图片

启动hiveserver服务

hive --service hiveserver2 &

进入hive客户端 

hive

测试语句

create table test (key string);

show tables ;

至此,安装已经完成。

【转载请注明出处】:https://www.jianshu.com/p/e559746a6568


编译hive2.3.2源码并搭建环境_第6张图片

你可能感兴趣的:(编译hive2.3.2源码并搭建环境)