1.場(chǎng)景分析
以Clickhouse、Doris、Starrocks等為代表的mpp分析數(shù)據(jù)庫(kù)正在快速的興起,以其高效查詢、跨庫(kù)整合能力收到廣大技術(shù)人員的喜愛(ài)。本文主要淺顯介紹下作者在使用Doris時(shí),通過(guò)建立catlog進(jìn)行跨庫(kù)查詢。
廢話不多少,直接上代碼文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-807288.html
2.相關(guān)配置
#Tidb外表,jdbc方式連接,如果沒(méi)有服務(wù)器權(quán)限可以直接在driver_url上填寫(xiě)jar包的maven地址
#如果報(bào)connect timeout,建議直接找運(yùn)維將jar包手動(dòng)放在服務(wù)器本地
CREATE CATALOG TiDB_catalog PROPERTIES (
"type"="jdbc",
"user"="xxxx",
"password"="xxx",
"jdbc_url" = "jdbc:mysql://xxx:4000",
"driver_url" = "https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.28/mysql-connector-java-8.0.28.jar",
"driver_class" = "com.mysql.cj.jdbc.Driver"
);
#mysql外表,jdbc方式連接,如果有服務(wù)器權(quán)限包的maven地址
#需將 Jar 包預(yù)先存放在 FE 和 BE 部署目錄的 jdbc_drivers/ 目錄下。系統(tǒng)會(huì)自動(dòng)在這個(gè)目錄下尋找。該目錄的位置,也可以由 fe.conf 和 be.conf 中的 jdbc_drivers_dir 配置修改。
#本地絕對(duì)路徑。如 file:///path/to/mysql-connector-java-5.1.47.jar。需將 Jar 包預(yù)先存放在所有 FE/BE 節(jié)點(diǎn)指定的路徑下。
CREATE CATALOG mysql_catalog PROPERTIES (
"type"="jdbc",
"user"="xxx",
"password"="xxx",
"jdbc_url" = "jdbc:mysql://xxxx:3306",
"driver_url" = "mysql-connector-java-8.0.28.jar",
"driver_class" = "com.mysql.cj.jdbc.Driver"
);
#psql外表,jdbc方式連接,如果沒(méi)有服務(wù)器權(quán)限可以直接在driver_url上填寫(xiě)jar包的maven地址
CREATE CATALOG postgresql_catalog PROPERTIES (
"type"="jdbc",
"user"="xxx",
"password"="xxx",
"jdbc_url" = "jdbc:postgresql://xxxx:5432/xxxx",
"driver_url" = "https://repo1.maven.org/maven2/org/postgresql/postgresql/42.5.1/postgresql-42.5.1.jar",
"driver_class" = "org.postgresql.Driver"
);
#hive外表,不用再?gòu)?fù)制配置文件到相應(yīng)的問(wèn)題,當(dāng)然自己手動(dòng)xml配置文件到指定位置也可
CREATE CATALOG hive_old PROPERTIES (
'type'='hms',
'hive.metastore.uris' = 'thrift://xxx:9083,thrift://xxx:9083',
'hadoop.username' = 'hadoop',
'dfs.nameservices'='xxx',
'dfs.ha.namenodes.mycluster'='nn1,nn2',
'dfs.namenode.http-address.mycluster.nn1'='xxx:9870',
'dfs.namenode.http-address.mycluster.nn2'='xxx:9870',
'dfs.namenode.rpc-address.mycluster.nn1'='xxx:8020',
'dfs.namenode.rpc-address.mycluster.nn2'='xxx:8020',
'dfs.client.failover.proxy.provider.mycluster'='org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider',
'fs.defaultF'='hdfs://xxx',
'ha.zookeeper.quorum'='xxx:2181,xxx:2181,xxx:2181',
'javax.jdo.option.ConnectionURL'='jdbc:mysql://xxx:3306/metastore?useSSL=false&createDatabaseIfNotExist=true&characterEncoding=UTF-8',
'javax.jdo.option.ConnectionDriverName'='com.mysql.jdbc.Driver',
'javax.jdo.option.ConnectionUserName'='xxx',
'javax.jdo.option.ConnectionPassword'='xxxx',
'hive.metastore.warehouse.dir'='/user/hive/warehouse',
'hive.server2.thrift.bind.host'='xxx',
'hive.server2.zookeeper.namespace'='hiveserver2_zk',
'hive.zookeeper.quorum'='xxxx:2181,xxx:2181,xxxx:2181',
'hive.zookeeper.client.port'='2181'
);
3.注意事項(xiàng)
騰訊的TCHouse-D (騰訊改版doris)已經(jīng)配置了jar包,無(wú)需自己手動(dòng)配置
騰訊官網(wǎng)介紹:https://cloud.tencent.com/document/product/1387/100593
Doris官網(wǎng)介紹:https://doris.apache.org/zh-CN/docs/1.2/lakehouse/external-table/jdbc文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-807288.html
到了這里,關(guān)于Doris配置外表以及多個(gè)Hive外表的配置的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!