Presto Oracle Plugin

前端之家收集整理的这篇文章主要介绍了Presto Oracle Plugin前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1、ojdbc6

下载需要的ojdbc6版本jar包,放在/home/hadoop/Downloads/目录,后面需要将这个jar包添加到maven库中以便编译使用

下载地址:http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html

添加ojdbc6.jar到maven库中,相关jar会自动生成在~/.m2/

mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.4 -Dpackaging=jar -Dfile=/home/hadoop/Downloads/ojdbc6.jar

[hadoop@breath Downloads]$ mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.4 -Dpackaging=jar -Dfile=/home/hadoop/Downloads/ojdbc6.jar   
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom ---
[INFO] Installing /home/hadoop/Downloads/ojdbc6.jar to /home/hadoop/.m2/repository/com/oracle/ojdbc6/11.2.0.4/ojdbc6-11.2.0.4.jar
[INFO] Installing /tmp/mvninstall4163536703052322468.pom to /home/hadoop/.m2/repository/com/oracle/ojdbc6/11.2.0.4/ojdbc6-11.2.0.4.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.524 s
[INFO] Finished at: 2017-05-07T13:56:39+08:00
[INFO] Final Memory: 9M/169M
[INFO] ------------------------------------------------------------------------

2、presto-oracle编译

编译需使用jdk1.8最新。

项目地址:https://github.com/marcelopaesrech/presto-oracle

[hadoop@breath ~]$ cd /tmp
[hadoop@breath tmp]$ git clone https://github.com/marcelopaesrech/presto-oracle.git
正克隆到 'presto-oracle'...
remote: Counting objects: 58,done.
remote: Total 58 (delta 0),reused 0 (delta 0),pack-reused 58
Unpacking objects: 100% (58/58),done.
[hadoop@breath tmp]$ cd presto-oracle
[hadoop@breath presto-oracle]$ java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13,mixed mode)
[hadoop@breath presto-oracle]$ mvn -v
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
Maven home: /opt/beh/core/maven
Java version: 1.8.0_121,vendor: Oracle Corporation
Java home: /opt/beh/core/jdk1.8.0_121/jre
Default locale: zh_CN,platform encoding: UTF-8
OS name: "linux",version: "3.10.0-327.22.2.el7.x86_64",arch: "amd64",family: "unix"

修改pom.xml文件修改为你需要部署的presto版本,

<version>0.147</version>

<dep.presto.version>0.147</dep.presto.version>

这里使用的是0.172,故修改为0.172

<version>0.172</version>

<dep.presto.version>0.172</dep.presto.version>

修改ojdbc6依赖。将如下部分修改

<dependency>
<groupId>ojdbc6</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3</version>
</dependency>

<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.4</version>
</dependency>

进行编译

mvn clean install

相关connector jar会生成在 target/presto-oracle-0.172.jar

[hadoop@breath presto-oracle]$ mvn clean install
...
...
...
[INFO] Installing /tmp/presto-oracle/target/presto-oracle-0.172.jar to /home/hadoop/.m2/repository/ml/prestoconnectors/presto-oracle/0.172/presto-oracle-0.172.jar
[INFO] Installing /tmp/presto-oracle/pom.xml to /home/hadoop/.m2/repository/ml/prestoconnectors/presto-oracle/0.172/presto-oracle-0.172.pom
[INFO] Installing /tmp/presto-oracle/target/presto-oracle-0.172-sources.jar to /home/hadoop/.m2/repository/ml/prestoconnectors/presto-oracle/0.172/presto-oracle-0.172-sources.jar
[INFO] Installing /tmp/presto-oracle/target/presto-oracle-0.172-javadoc.jar to /home/hadoop/.m2/repository/ml/prestoconnectors/presto-oracle/0.172/presto-oracle-0.172-javadoc.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:38 min
[INFO] Finished at: 2017-05-07T14:10:39+08:00
[INFO] Final Memory: 30M/224M
[INFO] ------------------------------------------------------------------------

3、presto-oracle connetor配置

将jar拷贝到相关plugin/oracle目录,先切换至presto安装目录

[hadoop@breath presto]$ cd $PRESTO_HOME
[hadoop@breath presto]$ ll
总用量 216
drwxr-xr-x.  3 hadoop hadoop   4096 4月  11 10:23 bin
drwxrwxr-x.  3 hadoop hadoop     39 4月  12 13:56 data
drwxrwxr-x.  3 hadoop hadoop   4096 4月  12 13:58 etc
drwxr-xr-x.  2 hadoop hadoop   8192 4月  10 08:47 lib
-rw-r--r--.  1 hadoop hadoop 191539 4月  10 08:47 NOTICE
drwxr-xr-x. 22 hadoop hadoop   4096 5月   7 14:14 plugin
-rw-r--r--.  1 hadoop hadoop    119 4月  10 08:47 README.txt
[hadoop@breath presto]$ rm plugin/oracle/MysqL-connector*
[hadoop@breath presto]$ rm plugin/oracle/presto-MysqL*
[hadoop@breath presto]$ mv /tmp/presto-oracle/target/presto-oracle*.jar plugin/oracle
[hadoop@breath presto]$ cp /home/hadoop/Downloads/ojdbc6.jar plugin/oracle
[hadoop@breath presto]$ ll plugin/oracle/presto-oracle-0.172.jar 
-rw-rw-r-- 1 hadoop hadoop 10400 5月   7 14:10 plugin/oracle/presto-oracle-0.172.jar

创建配置文件$PRESTO_HOME/etc/catalog/oracle,并修改为相关的ip地址,端口,database,用户,密码。

connector.name=oracle
# connection-url must me the URL to access Oracle via JDBC. It can be different depending on your environment.
# Another example of the URL would be jdbc:oracle:thin:@//ip:port/database. For more information,please go to the JDBC driver docs
connection-url=jdbc:oracle:thin://ip:port/database
connection-user=myuser
connection-password=
原文链接:https://www.f2er.com/oracle/208099.html

猜你在找的Oracle相关文章