写个数仓吧(17) presto可视化

OLAP分析工具之Presto
Presto Server安装
1)下载地址
https://repo1.maven.org/maven2/com/facebook/presto/presto-server/0.196/presto-server-0.196.tar.gz
2)将presto-server-0.196.tar.gz导入hadoop102的/opt/software目录下,并解压到/opt/module目录

[atguigu@hadoop102 software]$ tar -zxvf presto-server-0.196.tar.gz -C /opt/module/

3)修改名称为presto

[atguigu@hadoop102 module]$ mv presto-server-0.196/ presto

4)进入到/opt/module/presto目录,并创建存储数据文件夹

[atguigu@hadoop102 presto]$ mkdir data

5)进入到/opt/module/presto目录,并创建存储配置文件文件夹

[atguigu@hadoop102 presto]$ mkdir etc

6)配置在/opt/module/presto/etc目录下添加jvm.config配置文件

[atguigu@hadoop102 etc]$ vim jvm.config

添加如下内容

-server
-Xmx16G
-XX:+UseG1GC
-XX:G1HeapRegionSize=32M
-XX:+UseGCOverheadLimit
-XX:+ExplicitGCInvokesConcurrent
-XX:+HeapDumpOnOutOfMemoryError
-XX:+ExitOnOutOfMemoryError

7)Presto可以支持多个数据源,在Presto里面叫catalog,这里我们配置支持Hive的数据源,配置一个Hive的catalog

[atguigu@hadoop102 etc]$ mkdir catalog
[atguigu@hadoop102 catalog]$ vim hive.properties 

添加如下内容

connector.name=hive-hadoop2
hive.metastore.uri=thrift://hadoop102:9083

8)将hadoop102上的presto分发到hadoop103、hadoop104

[atguigu@hadoop102 module]$ xsync presto

9)解压之后,分别进入hadoop102、hadoop103、hadoop104三台主机的/opt/module/presto/etc的路径。配置node属性,node id每个节点都不一样。

[atguigu@hadoop102 etc]$vim node.properties
node.environment=production
node.id=ffffffff-ffff-ffff-ffff-ffffffffffff
node.data-dir=/opt/module/presto/data
[atguigu@hadoop103 etc]$vim node.properties
node.environment=production
node.id=ffffffff-ffff-ffff-ffff-fffffffffffe
node.data-dir=/opt/module/presto/data
[atguigu@hadoop104 etc]$vim node.properties
node.environment=production
node.id=ffffffff-ffff-ffff-ffff-fffffffffffd
node.data-dir=/opt/module/presto/data

10)Presto是由一个coordinator节点和多个worker节点组成。在hadoop102上配置成coordinator,在hadoop103、hadoop104上配置为worker。
(1)hadoop102上配置coordinator节点

[atguigu@hadoop102 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://hadoop102:8881

(2)hadoop103、hadoop104上配置worker节点

[atguigu@hadoop103 etc]$ vim config.properties

添加内容如下

coordinator=false
http-server.http.port=8881
query.max-memory=50GB
discovery.uri=http://hadoop102:8881
[atguigu@hadoop104 etc]$ vim config.properties

添加内容如下

coordinator=false
http-server.http.port=8881
query.max-memory=50GB
discovery.uri=http://hadoop102:8881

11)在/opt/module/hive目录下,启动Hive Metastore,用atguigu角色

nohup bin/hive --service metastore >/dev/null 2>&1 &

12)分别在hadoop102、hadoop103、hadoop104上启动presto server
(1)前台启动presto,控制台显示日志

[atguigu@hadoop102 presto]$ bin/launcher run
[atguigu@hadoop103 presto]$ bin/launcher run
[atguigu@hadoop104 presto]$ bin/launcher run

(2)后台启动presto

[atguigu@hadoop102 presto]$ bin/launcher start
[atguigu@hadoop103 presto]$ bin/launcher start
[atguigu@hadoop104 presto]$ bin/launcher start
13)日志查看路径/opt/module/presto/data/var/log

Presto命令行Client安装
1)下载Presto的客户端
https://repo1.maven.org/maven2/com/facebook/presto/presto-cli/0.196/presto-cli-0.196-executable.jar
2)将presto-cli-0.196-executable.jar上传到hadoop102的/opt/module/presto文件夹下
3)修改文件名称

[atguigu@hadoop102 presto]$ mv presto-cli-0.196-executable.jar  prestocli

4)增加执行权限

[atguigu@hadoop102 presto]$ chmod +x prestocli

5)启动prestocli

[atguigu@hadoop102 presto]$ ./prestocli --server hadoop102:8881 --catalog hive --schema default

6)Presto命令行操作
Presto的命令行操作,相当于hive命令行操作,不过没有use命令。每个表必须要加上schema。
例如:

select * from schema.table limit 100

9.3 Presto可视化Client安装
1)将yanagishima-18.0.zip上传到hadoop102的/opt/module目录
2)解压缩yanagishima

[atguigu@hadoop102 module]$ unzip yanagishima-18.0.zip
cd yanagishima-18.0

3)进入到/opt/module/yanagishima-18.0/conf文件夹,编写yanagishima.properties配置
[atguigu@hadoop102 conf]$ vim yanagishima.properties
添加如下内容

jetty.port=7080
presto.datasources=atiguigu-presto
presto.coordinator.server.atiguigu-presto=http://hadoop102:8881
catalog.atiguigu-presto=hive
schema.atiguigu-presto=default
sql.query.engines=presto

4)在/opt/module/yanagishima-18.0路径下启动yanagishima

[atguigu@hadoop102 yanagishima-18.0]$
nohup bin/yanagishima-start.sh >y.log 2>&1 &

5)启动web页面

http://hadoop102:7080 

看到界面,进行查询了。
9.4 Presto可视化操作
查看表结构
在这里插入图片描述

这里有个tree view,可以查看所有表的结构,包括schema、表、字段等。
比如执行 select * from hive.dw_weather.tmp_news_click limit 10,这个句子里hive这个词可以删掉,是上面配置的catalog
在这里插入图片描述

每个表后面都有个复制键,点一下会复制完整的表名,然后再上面框里面输入sql语句,ctrl+enter键执行显示结果
在这里插入图片描述


版权声明:本文为KujyouRuri原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。