presto体验

环境配置 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

[root@localhost 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文件夹

[root@localhost 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

[root@localhost 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]

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

走到无路可退

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值