跨mysql和mongodb查询工具_presto使用hive与mysql(mongodb,oracle)等跨库查询

本文介绍了如何配置Presto以实现跨数据库查询,包括连接到Hive、MySQL、Oracle和MongoDB。通过在Hive的hive-site.xml配置 metastore URIs,并在Presto的catalog目录下设置相应的数据库属性文件(如hive.properties、mysql.properties等),可以实现跨库查询。启动Presto服务器后,使用SmartBI创建Presto数据源,即可查看并查询不同数据库的表。
摘要由CSDN通过智能技术生成

首先presto是通过hive metastore来访问hive的,所以需要在hive/conf目录下配置hive-site.xml的

hive.metastore.uris属性

hive.metastore.uris

thrift://ip:9083

Thrift URI for the remote metastore. Used by metastore client to connect to remote metastore.

736e413df7ef93d8bf2303ca12a261de.png

然后在presto-server\etc\catalog\smartbix里面配置hive.properties,mysql.properties等文件内容

hive.properties文件

connector.name=hive-hadoop2

hive.metastore.uri=thrift:/ip:9083(具体hive.metastore.uris可在hive-site.xml里面配置)

mysql.properties文件

connector.name=mysql

connection-url=jdbc:mysql://ip:port?useCursorFetch=true&defaultFetchSize=10000

connection-user=username

connection-password=password

oracle.properties文件

connector.name=oracle

connection-driver=oracle.jdbc.OracleDriver

connection-identifier-quote="

connection-url=jdbc:oracle:thin:@ip:port:

connection-user=username

connection-password=password

mongodb.properties文件

connector.name=mongodb

mongodb.seeds=ip:27017

配置完后启动presto服务器,通过smartbi新建关系数据源presto连接

c88f34d1ff8d32380c1ead2389b9ad3f.png

右键presto数据源的数据库管理查看各个类型数据库表,并添加至右侧

980e6c78fe14ff9fd3d6a9443fb376e6.png

利用smartbi原生SQL进行查询

ad8e81584828cc30248d70ca8ceb43b7.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值