presto编译部署

背景

新公司需要部署大数据平台做一个数仓,经过调研,决定使用presto作为ETL和OLAP工具,需要支持Oracle,MySQL,SQLServer等多数据源。这里比较特殊的是对Oracle的支持,presto本身不带Oracle插件,需要自己实现。网上找了个比较新的版本,是对presto-0.224版本的支持,决定暂时使用presto-0.224版本,后面自己更新到最新版本。

环境准备

maven安装

presto源码部署需要maven大于3.3.9版本,我使用的是3.6.3版本。
// 下载
wget http://mirrors.hust.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
// 解压
tar -xvf apache-maven-3.6.3-bin.tar.gz 
// 配置环境变量
//打开环境变量的配置文件
vim /etc/profile
//新增行MAVEN_HOME,等于号后面是maven解压的文件夹地址
export MAVEN_HOME=/opt/apache-maven-3.6.3
//找到PATH行,追加$MAVEN_HOME/bin
例如
PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH
//重新刷新配置文件
source /etc/profile 
// 测试
mvn -v 

maven配置国内源

我们一般使用国内源,可以极大提高下载速度。

// 配置国内源
vim  /opt/apache-maven-3.6.3/conf/settings.xml 
// 在mirrors节点下新增
<mirror>
            <id>nexus-aliyun</id>
            <mirrorOf>*</mirrorOf>
            <name>Nexus aliyun</name>
            <url>http://maven.aliyun.com/nexus/content/groups/public</url>
        </mirror>
        <mirror>
            <id>alimaven-central</id>
            <mirrorOf>central</mirrorOf>
            <name>aliyun maven</name>
            <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
        </mirror>
        <mirror>
            <id>jboss-public-repository-group</id>
            <mirrorOf>central</mirrorOf>
            <name>JBoss Public Repository Group</name>
            <url>http://repository.jboss.org/nexus/content/groups/public</url>
        </mirror>
        <mirror>
            <id>alimaven</id>
            <name>aliyun maven</name>
            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
            <mirrorOf>central</mirrorOf>
        </mirror>
        <mirror>
          <id>mirrorId</id>
          <mirrorOf>repositoryId</mirrorOf>
          <name>Human Readable Name for this Mirror.</name>
          <url>http://my.repository.com/repo/path</url>
        </mirror>

下载

presto-0.224下载

// 如果网速可以,直接git clone
git clone https://github.com/prestodb/presto.git
git tag
# 可以看到不同的版本,找到最新的 0.224
git checkout tags/0.224
# 可以看到已经切换到此分支了
git branch

如果网速不行,从网页release页面下载presto-0.224.tar.gz
在这里插入图片描述

oracle插件下载

//  这里也可以git clone或者直接下载压缩包,给出地址
https://github.com/yousyuukai/presto-oracle

编译

编译presto

//  如果是从release页面下载压缩包,编译会报下面的错
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  02:19 min (Wall Clock)
[INFO] Finished at: 2019-05-12T02:57:56+08:00
[INFO] ------------------------------------------------------------------------
Downloaded from nexus-aliyun: http://maven.aliyun.com/nexus/content/groups/public/io/airlift/units/1.3/units-1.3.jar (18 kB at 129 kB/s)
Downloading from nexus-aliyun: http://maven.aliyun.com/nexus/content/groups/public/org/apache/commons/commons-lang3/3.4/commons-lang3-3.4.jar
[ERROR] Failed to execute goal pl.project13.maven:git-commit-id-plugin:2.1.13:revision (default) on project presto-matching: .git directory could not be found! Please specify a valid [dotGitDirectory] in your pom.xml -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :presto-matching

问题解决。原因很简单,就是下载的release源码包中每个.git文件夹,但是git-commit-id-plugin插件又是需要这个目录的,我们在父模块的pom.xml中却并没有发现引用这个插件,其实这是airbase中依赖了git-commit-id-plugin插件,因此在父模块的pom.xml文件中引入如下插件,并跳过此插件的配置的,大概在1335行左右,在标签中的中添加就行。

//  修改根目录下pom.xml
<plugin>
	<groupId>pl.project13.maven</groupId>
	<artifactId>git-commit-id-plugin</artifactId>
	<configuration>
	<skip>true</skip>
	</configuration>
</plugin>
//  编译
mvn clean install -DskipTests

编译Oracle插件

//  下载ojdbc8
https://www.oracle.com/database/technologies/jdbc-ucp-122-downloads.html

//  安装到本地仓库
mvn install:install-file -Dfile=D:\ojdbc8.jar -DgroupId=com.oracle -DartifactId=ojdbc8 -Dversion=0.0.1 -Dpackaging=jar -DgeneratePom=true


//  编译Oracle插件
mvn clean install -DskipTests

部署

//  需要将编译好的插件放到presto的plugin目录下
 cp -r $PRESTO_HOME/plugin/mysql $PRESTO_HOME/plugin/oracle 
 rm $PRESTO_HOME/plugin/oracle/mysql-connector* 
 rm $PRESTO_HOME/plugin/oracle/presto-mysql* 
 mv $ORACLE_PLUGIN/presto-oracle*.jar $PRESTO_HOME/plugin/oracle 
 mv $OJDBC8_HOME/ojdbc8.jar $PRESTO_HOME/plugin/oracle
//  Oracle的连接配置
connector.name=oracle
connection-url=jdbc:oracle:thin:@//xxxx:xxxx/database
connection-user=xxxx
connection-password=xxxx

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值