Presto是一个运行在机器集群上的分布式系统。完整的安装包括一个协调程序和多个工作程序。查询从客户端(如Presto CLI)提交到协调器。协调器解析、分析和计划查询执行,然后将处理分配给工作者。
安装包下载https://repo1.maven.org/maven2/com/facebook/presto
新建etc目录
mkdir -p /opt/presto-server/etc
新建文件:etc/node.properties
node.environment=production
node.id=hadoop
node.data-dir=/opt/presto-server/data
新建文件:etc/jvm.config
-server
-Xmx1G
-XX:+UseG1GC
-XX:G1HeapRegionSize=8M
-XX:+UseGCOverheadLimit
-XX:+ExplicitGCInvokesConcurrent
-XX:+HeapDumpOnOutOfMemoryError
-XX:+ExitOnOutOfMemoryError
新建文件:etc/config.properties
coordinator=true
node-scheduler.include-coordinator=true
http-server.http.port=9090
query.max-memory=1GB
query.max-memory-per-node=1GB
query.max-total-memory-per-node=1GB
discovery-server.enabled=true
discovery.uri=http://hadoop:9090
新建文件:etc/log.properties
com.facebook.presto=INFO
connectors配置
新建目录:etc/catalog,配置hive.properties
connector.name=hive
hive.metastore.uri=thrift://hadoop:9083
hive.parquet.fail-on-corrupted-statistics=false
启动Presto
bin/launcher start
查看http://hadoop:9090/ui/
Presto-cli的使用【将presto-cli-0.228-executable.jar重命名presto-cli即可】
[root@hadoop presto]# ./presto-cli --server hadoop:9090 --catalog hive
presto> help
Supported commands:
QUIT
EXPLAIN [ ( option [, ...] ) ]
options: FORMAT { TEXT | GRAPHVIZ }
TYPE { LOGICAL | DISTRIBUTED }
DESCRIBE
SHOW COLUMNS FROM
SHOW FUNCTIONS
SHOW CATALOGS [LIKE ]
SHOW SCHEMAS [FROM ] [LIKE ]
SHOW TABLES [FROM ] [LIKE ]
USE [.]
presto> show schemas;
Schema
--------------------
default
edw
information_schema
(3 rows)
Query 20200218_101852_00000_wmc57, FINISHED, 1 node
Splits: 19 total, 19 done (100.00%)
0:02 [3 rows, 43B] [1 rows/s, 23B/s]
presto> use edw;
USE
presto:edw> show tables;
Table
------------------
t_mkt_custr_info
t_mkt_event_info
(2 rows)
Query 20200218_101910_00002_wmc57, FINISHED, 1 node
Splits: 19 total, 19 done (100.00%)
0:01 [2 rows, 58B] [1 rows/s, 43B/s]
presto:edw> quit
作者:Mr.ChowSit