環境配置 Linux 記憶體 6G 不建議記憶體過低,容易一執行語句就會閃退 ,本配置的是一個 coordinator與worker在一起的,推薦一篇文章 https://segmentfault.com/a/1190000014833443
JAVA
openjdk version "1.8.0_272"
OpenJDK Runtime Environment (build 1.8.0_272-b10)
OpenJDK 64-Bit Server VM (build 25.272-b10, mixed mode)
下載下傳,presto-server-0.242.tar.gz,presto-cli-0.242-executable.jar
下載下傳位址:https://prestodb.io/download.html
[[email protected] presto]# ls -l
total 829964
-rwxr-xr-x 1 root root 15210612 Dec 9 04:03 presto-cli-0.242-executable.jar
drwxr-xr-x 3 root root 42 Dec 10 00:42 presto-datadir
-rw-r--r-- 1 root root 9283178 Dec 9 04:03 presto-jdbc-0.242.jar
drwxr-xr-x 7 root root 96 Dec 9 21:19 presto-server-0.242
-rw-r--r-- 1 root root 825382571 Dec 9 04:03 presto-server-0.242.tar.gz
presto-cli-0.242-executable.jar 是等下連接配接presto的工具
presto-datadir 是資料目錄,是自己建立的
解壓 presto-server-0.242.tar.gz 得到 presto-server-0.242
進入 presto-server-0.242
建立etc 檔案夾
進入etc檔案夾
[[email protected] etc]# ls -l
total 16
drwxr-xr-x 2 root root 62 Dec 10 00:21 catalog
-rw-r--r-- 1 root root 242 Dec 10 00:42 config.properties
-rw-r--r-- 1 root root 171 Dec 10 00:41 jvm.config
-rw-r--r-- 1 root root 28 Dec 9 21:15 log.properties
-rw-r--r-- 1 root root 91 Dec 10 00:22 node.properties
vim config.properties
coordinator=true
node-scheduler.include-coordinator=true
http-server.http.port=8081
query.max-memory=4GB
query.max-memory-per-node=1GB
query.max-total-memory-per-node=2GB
discovery-server.enabled=true
discovery.uri=http://192.168.1.148:8081
vim jvm.config
-server
-Xmx4G
-XX:+UseG1GC
-XX:G1HeapRegionSize=64M
-XX:+UseGCOverheadLimit
-XX:+ExplicitGCInvokesConcurrent
-XX:+HeapDumpOnOutOfMemoryError
-XX:+ExitOnOutOfMemoryError
vim log.properties
com.facebook.presto = INFO
vim node.properties
node.environment=production
node.id=presto1
node.data-dir=/software/presto/presto-datadir
建立資料源管理的檔案夾 catalog
[[email protected] catalog]# ls -l
total 8
-rw-r--r-- 1 root root 143 Dec 10 00:21 elasticsearch.properties
-rw-r--r-- 1 root root 228 Dec 9 23:39 mysql.properties
vim elasticsearch.properties
connector.name=elasticsearch
elasticsearch.host=127.0.0.1
elasticsearch.port=9200
elasticsearch.default-schema-name=person_info_content
vim mysql.properties
connector.name=mysql
connection-url=jdbc:mysql://127.0.0.1:3306?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&failOverReadOnly=false
connection-user=root
connection-password=123456
配置結束
前台啟動,友善看日志
bin/launcher run
背景啟動,停止
bin/launcher start
bin/launcher stop
使用 presto-cli-0.242-executable.jar 連接配接服務
./presto-cli-0.242-executable.jar --server 192.168.1.148:8081
presto> show catalogs;
Catalog
---------------
elasticsearch
mysql
system
(3 rows)
Query 20201210_063806_00000_yekh2, FINISHED, 1 node
Splits: 19 total, 19 done (100.00%)
0:02 [0 rows, 0B] [0 rows/s, 0B/s]
連表查
presto> select a.person_idCard,b.name from elasticsearch.person_info_content.person_info_content a left join mysql.rhzy_sbk.person b on a.person_idCard = b.idCard where a.person_idCard = '111111111111111111';
person_idcard | name
--------------------+--------
111111111111111111| 某某某
(1 row)
Query 20201210_063833_00001_yekh2, FINISHED, 1 node
Splits: 66 total, 66 done (100.00%)
0:03 [161K rows, 38B] [57.5K rows/s, 13B/s]