presto联合查询mysql和ES_presto-mysql/elasticsearch6.0.0安装部署测试,异种数据源关联查询入门实践...
本文簡單記錄一次實踐使用過程,涉及presto-mysql,presto-elasticsearch,文中參數未做注釋,請參考官方文檔,希望能幫到大家
1 下載安裝 presto-0.228
<1>下載
服務端
客戶端
相關jar
<2>安裝:
1> 解壓
tar -zxvf presto-server-0.228.tar.gz
2>創建配置目錄 etc? etc/catalog
cd presto-server-0.228/
mk dir etc
mkdir etc
mkdir data
cd etc
mkdir catalog
3>創建config.properties 集群配置
在新建的etc目錄下
vim config.properties
coordinator=true
node-scheduler.include-coordinator=true
http-server.http.port=9080
query.max-memory=8GB
query.max-memory-per-node=1GB
query.max-total-memory-per-node=2GB
discovery-server.enabled=true
discovery.uri=http://xinyi:9080
4>創建jvm.config 運行環境配置
在新建的etc目錄下
vim jvm.config
-server
-Xmx16G
-XX:+UseG1GC
-XX:G1HeapRegionSize=32M
-XX:+UseGCOverheadLimit
-XX:+ExplicitGCInvokesConcurrent
-XX:+HeapDumpOnOutOfMemoryError
-XX:+ExitOnOutOfMemoryError
5>創建log.properties 日志配置
在新建的etc目錄下
vim log.properties
com.facebook.presto=INFO
6>創建node.properties ,節點配置
在新建的etc目錄下
vim log.properties
node.environment=production
node.id=ffffffff-ffff-ffff-ffff-fffffffffff1
node.data-dir=/opt/presto-server-0.228/data
7>啟動
cd /安裝目錄/bin
./launcher start 后臺啟動
./launcher stop停止
./launcher run 前臺啟動,輸出日志
./launcher restart 重啟
8>/安裝目錄/var/log以下位置找到日志文件
launcher.log
server.log
http-request.log
<3> 安裝客戶端
重命名presto-cli-0.228-executable.jar位presto
mv presto-cli-0.228-executable.jar presto
使用命令:
./presto --server locahost:9080 --catalog mysql--schema test
2 presto-mysql
<1>在 /etc/catalog/目錄下創建mysql.properties
connector.name=mysql
connection-url=jdbc:mysql://localhost:3306
connection-user=root
connection-password=root
<2>重啟presto-server
/launcher restart
<3>測試
在客戶端安裝目錄執行
./presto --server locahost:9080 --catalog mysql--schema test
presto:es> select * from mysql.test.test;
3 presto-elasticsearch
elasticsearch版本最好與plugin目錄下elasticsearch版本一致
<1>在 /安裝目錄/etc/catalog/目錄下創建elasticsearch.properties
connector.name=elasticsearch
#elasticsearch.default-schema=default
elasticsearch.table-description-directory=etc/elasticsearch/
elasticsearch.scroll-size=1000
elasticsearch.scroll-timeout=2s
elasticsearch.request-timeout=2s
elasticsearch.max-request-retries=5
elasticsearch.max-request-retry-time=10s
<2>創建elasticsearch目錄
cd /安裝目錄/etc/
mkdir elasticsearch
cd elasticsearch
<3>定義表的描述文件(自定義表名.json)
cd elasticsearch
vim test.json
{"tableName": "es_test",
"schemaName": "es",
"host": "es-ip地址",
"port": 9300,
"clusterName": "my-application",
"index": "test",
"indexExactMatch": false,
"type": "test",
"columns": [
{
"name": "name",
"type": "varchar",
"jsonPath":"name",
"jsonType":"varchar"
},
{
"name": "age",
"type": "integer",
"jsonPath":"age",
"jsonType":"integer"
}
]
}
<4>重啟presto-server
/launcher restart
<5>測試
./presto --server locahost:9080 --catalog elasticsearch --schema es
presto:es> select * from elasticsearch.es.es_test;
name | age
------+-----
HL?? |? 12
HLl? |? 18
(2 rows)
4 多數據源查詢
./presto --server locahost:9080 --catalog elasticsearch --schema es
presto:es> select * from mysql.test.user t left join elasticsearch.es.es_test t1 on t.age=t1.age;
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的presto联合查询mysql和ES_presto-mysql/elasticsearch6.0.0安装部署测试,异种数据源关联查询入门实践...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ext js如何动态更改xtype_K8
- 下一篇: python编写add函数求和_为什么p