1、基于内存计算,减少了磁盘IO,计算快;
2、能够连接多数据源
3、Impala性能稍领先于Presto,但是Presto在数据源支持上非常丰富,包括Hive、图数据库、传统关系型数据库、Redis等。
(2)缺点能处理PB级别的数据,但是并不是把所有数据都放入内存中计算。简单的聚合是边读数据边计算,再清内存,再读数据再计算,这种消耗内存并不高。
连表查询,会产生大量临时数据,速度就会慢。
二、架构图 三、下载及安装 (1)Presto Server安装1)下载地址
https://repo1.maven.org/maven2/com/facebook/presto/presto-server/0.196/presto-server-0.196.tar.gz
2)上传、解压
tar -zxvf ./presto-server-0.196.tar.gz -C /opt/apps/presto/
- 进入presto-server-0.196
# 创建文件夹 # 存储数据文件夹 [root@centos01 presto-server-0.196]# mkdir data # 配置文件文件夹 [root@centos01 presto-server-0.196]# mkdir etc # 在/etc下添加文件 [root@centos01 etc]# vim jvm.config # 文件内容 -server -Xmx16G -XX:+UseG1GC -XX:G1HeapRegionSize=32M -XX:+UseGCOverheadLimit -XX:+ExplicitGCInvokesConcurrent -XX:+HeapDumponOutOfMemoryError -XX:+ExitonOutOfMemoryError
4)Presto可以支持多个数据源,在Presto里面叫catalog,这里我们配置支持Hive的数据源,配置一个Hive的catalog
[root@centos01 etc]# mkdir catalog # 进入catalog [root@centos01 etc]# cd catalog/ [root@centos01 catalog]# vim hive.properties # 添加内容 connector.name=hive-hadoop2 hive.metastore.uri=thrift://centos01:9083
- 分发
[root@centos01 apps]# scp -r ./presto/ centos02:/opt/apps/ [root@centos01 apps]# scp -r ./presto/ centos03:/opt/apps/
- 分发之后,分别进入这三台主机的etc的路径。配置node属性,node id每个节点都不一样。
[root@centos01 etc]# pwd /opt/apps/presto/presto-server-0.196/etc [root@centos01 etc]# ll total 4 drwxr-xr-x. 2 root root 29 Nov 17 20:49 catalog -rw-r--r--. 1 root root 171 Nov 17 20:52 jvm.config [root@centos01 etc]# vim node.properties node.environment=production node.id=ffffffff-ffff-ffff-ffff-fffffffffffe node.data-dir=/opt/apps/presto/presto-server-0.196/data [root@centos02 etc]# vim node.properties node.environment=production node.id=ffffffff-ffff-ffff-ffff-ffffffffffff node.data-dir=/opt/apps/presto/presto-server-0.196/data [root@centos03 etc]# vim node.properties node.environment=production node.id=ffffffff-ffff-ffff-ffff-fffffffffffg node.data-dir=/opt/apps/presto/presto-server-0.196/data
- Presto是由一个coordinator节点和多个worker节点组成。在centos01上配置成coordinator,在centos02、centos03上配置为worker。
# 在centos01上配置成coordinator [root@centos01 etc]# vim config.properties coordinator=true node-scheduler.include-coordinator=false http-server.http.port=8881 query.max-memory=50GB discovery-server.enabled=true discovery.uri=http://centos01:8881 # 在centos02、centos03上配置为worker [root@centos02 etc]# vim config.properties coordinator=false http-server.http.port=8881 query.max-memory=50GB discovery.uri=http://centos01:8881 [root@centos03 etc]# vim config.properties coordinator=false http-server.http.port=8881 query.max-memory=50GB discovery.uri=http://centos01:8881
- 启动Hive metastore
nohup hive --service metastore >/dev/null 2>&1 &
- 分别在三台机器上启动Presto Server
(1)前台启动Presto,控制台显示日志
[root@centos01 presto-server-0.196]# ./bin/launcher run [root@centos02 presto-server-0.196]# ./bin/launcher run [root@centos03 presto-server-0.196]# ./bin/launcher run
(2)后台启动Presto
[root@centos01 presto-server-0.196]# ./bin/launcher start [root@centos02 presto-server-0.196]# ./bin/launcher start [root@centos03 presto-server-0.196]# ./bin/launcher start(2) Presto命令行Client安装
客户端的下载地址:
https://repo1.maven.org/maven2/com/facebook/presto/presto-cli/0.196/presto-cli-0.196-executable.jar
将presto-cli-0.196-executable.jar上传到centos01的/opt/apps/presto文件夹下
# 改名
[root@centos01 presto]# mv presto-cli-0.196-executable.jar prestocli
# 增加执行权限
[root@centos01 presto]# chmod +x prestocli
# 启动
[root@centos01 presto]# ./prestocli --server centos01:8881 --catalog hive --schema default
# 执行命令
presto:default> show schemas;
presto:default> use ods;
USE
presto:ods> show tables;
Table
---------------
app_event_log
# 注意:每个表必须要加上schema(即数据库名称)
presto:ods> select * from ods.app_event_log t limit 10;
(3)Presto可视化Client安装
# 解压 [root@centos01 presto]# unzip yanagishima-18.0.zip [root@centos01 presto]# cd yanagishima-18.0/ # 编写yanagishima.properties配置 [root@centos01 conf]# vim yanagishima.properties # 添加下面的内容,注意是添加 jetty.port=7080 presto.datasources=yyds-presto presto.coordinator.server.yyds-presto=http://centos01:8881 catalog.yyds-presto=hive schema.yyds-presto=default sql.query.engines=presto # 启动 [root@centos01 yanagishima-18.0]# nohup bin/yanagishima-start.sh >y.log 2>&1 &
前端页面:
http://192.168.42.101:7080



