当前位置:网站首页>即席查询——Presto
即席查询——Presto
2022-08-04 00:38:00 【丝丝呀】
1 Presto安装
1.1 Presto Server安装
1)导入安装包
[[email protected] software]$ mkdir presto
[[email protected] software]$ cd presto/
[[email protected] presto]$ ll

2)部署
[[email protected] presto]$ tar -zxvf presto-server-0.196.tar.gz -C /opt/module/

[[email protected] module]$ mv presto-server-0.196/ presto
[[email protected] module]$ cd presto/
[[email protected] presto]$ ll

[[email protected] presto]$ mkdir data
[[email protected] presto]$ mkdir etc

配置在/opt/module/presto/etc目录下添加jvm.config配置文件
[[email protected] presto]$ cd etc/
[[email protected] etc]$ vim jvm.config
添加如下内容
-server
-Xmx16G
-XX:+UseG1GC
-XX:G1HeapRegionSize=32M
-XX:+UseGCOverheadLimit
-XX:+ExplicitGCInvokesConcurrent
-XX:+HeapDumpOnOutOfMemoryError
-XX:+ExitOnOutOfMemoryError

Presto可以支持多个数据源,在Presto里面叫catalog,这里我们配置支持Hive的数据源,配置一个Hive的catalog
[[email protected] etc]$ mkdir catalog
[[email protected] etc]$ cd catalog/
[[email protected] catalog]$ ll
[[email protected] catalog]$ vim hive.properties
添加内容:
connector.name=hive-hadoop2
hive.metastore.uri=thrift://hadoop102:9083

将hadoop102上的presto分发到hadoop103、hadoop104
[[email protected] module]$ xsync presto
分发之后,分别进入hadoop102、hadoop103、hadoop104三台主机的/opt/module/presto/etc的路径。配置node属性,node id每个节点都不一样。
[[email protected] etc]$ vim node.properties
node.environment=production
node.id=ffffffff-ffff-ffff-ffff-ffffffffffff
node.data-dir=/opt/module/presto/data

[[email protected] etc]$ xsync node.properties

再去修改id
[[email protected] ~]$ cd /opt/module/presto/etc/
[[email protected] etc]$ vim node.properties
随便修改id,保证不一样就行

[[email protected]~]$ cd /opt/module/presto/etc/
[[email protected] etc]$ vim node.properties
Presto是由一个coordinator节点和多个worker节点组成。在hadoop102上配置成coordinator,在hadoop103、hadoop104上配置为worker。
(1)hadoop102上配置coordinator节点
[[email protected] 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节点
[[email protected] etc]$ vim config.properties
添加内容如下
coordinator=false
http-server.http.port=8881
query.max-memory=50GB
discovery.uri=http://hadoop102:8881

[[email protected] etc]$ vim config.properties
添加内容如下
coordinator=false
http-server.http.port=8881
query.max-memory=50GB
discovery.uri=http://hadoop102:8881
3)启动
在hadoop102的/opt/module/hive目录下,启动Hive Metastore,用zhang角色
[[email protected] etc]$ hive --service metastore

分别在hadoop102、hadoop103、hadoop104上启动Presto Server
(1)前台启动Presto,控制台显示日志
[[email protected] presto]$ bin/launcher run
[[email protected] presto]$ bin/launcher run
[[email protected] presto]$ bin/launcher run
(2)后台启动Presto
[[email protected] presto]$ bin/launcher start
[[email protected] presto]$ bin/launcher start
[[email protected] presto]$ bin/launcher start
1.2 Presto命令行Client安装
将presto-cli-0.196-executable.jar上传到hadoop102的/opt/module/presto文件夹下
[[email protected] presto]$ cd /opt/software/presto/
修改文件名称
[[email protected] presto]$ mv presto-cli-0.196-executable.jar prestocli
增加执行权限
[[email protected] presto]$ chmod +x prestocli
启动prestocli
[[email protected] presto]$ ./prestocli --server hadoop102:8881 --catalog hive --schema default

Presto命令行操作
Presto的命令行操作,相当于Hive命令行操作。每个表必须要加上schema。
例如:
select * from schema.table limit 100

Presto客户端查询的内容是一页一页展示的,按回车换行,按空格翻页;想要继续查询其他语句,直接写SQL是不行的,需要按q退出当前查询。
presto对Lzo的使用说明:
把jar包放opt/module/presto/plugin/hive-hadoop2/下
[[email protected] presto]$ cd /opt/module/presto/plugin/hive-hadoop2/
[[email protected] hive-hadoop2]$ cp /opt/module/hadoop-3.1.3/share/hadoop/common/hadoop-lzo-0.4.20.jar ./
[[email protected] hive-hadoop2]$ xsync hadoop-lzo-0.4.20.jar

重启presto
1.3 Presto可视化Client安装
[[email protected] presto]$ cd /opt/software/presto/

解压[[email protected] presto]$ unzip yanagishima-18.0.zip -d /opt/module/

[[email protected] presto]$ cd /opt/module/yanagishima-18.0/
[[email protected] yanagishima-18.0]$ vim conf/yanagishima.properties
添加内容
jetty.port=7080
presto.datasources=zhang-presto
presto.coordinator.server.zhang-presto=http://hadoop102:8881
catalog.zhang-presto=hive
schema.zhang-presto=default
sql.query.engines=presto

前台启动
[[email protected] yanagishima-18.0]$ bin/yanagishima-start.sh

启动web页面 http://hadoop102:7080



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

边栏推荐
- Electronics manufacturing enterprise deployment WMS what are the benefits of warehouse management system
- 哎,又跟HR在小群吵了一架!
- .NET静态代码织入——肉夹馍(Rougamo) 发布1.1.0
- boot issue
- 因为一次bug的教训,我决定手撕Nacos源码(先撕客户端源码)
- 分布式事务框架 seata
- Google Earth Engine ——利用公开的河流数据计算河流的有效宽度
- Apache DolphinScheduler新一代分布式工作流任务调度平台实战-中
- 2015年开源大事件汇总
- 虚拟机CentOS7中无图形界面安装Oracle
猜你喜欢

LeetCode third topic (the Longest Substring Without Repeating Characters) trilogy # 3: two optimization

全面讲解 Handler机制原理解析 (小白必看)

通过whl安装第三方包

C语言 函数递归

Talking about the future development direction of my country's industrial parks

BioVendor人Clara细胞蛋白(CC16)Elisa试剂盒检测步骤

带你造轮子,自定义一个随意拖拽可吸边的悬浮View组件

关于mnn模型输出的数据杂乱无章问题

typescript53 - generic constraints

Apple told Qualcomm: I bought a new campus for $445 million and may plan to speed up self-development of baseband chips
随机推荐
ES6高级-迭代器与生成器的用法
RSS订阅微信公众号初探-feed43
The Beijing E-sports Metaverse Forum was successfully held
600MHz频段来了,它会是新的黄金频段吗?
查看CUDA、pytorch等的版本号
Apple told Qualcomm: I bought a new campus for $445 million and may plan to speed up self-development of baseband chips
GeoAO:一种快速的环境光遮蔽方案
利用matlab求解线性优化问题【基于matlab的动力学模型学习笔记_11】
C# wpf使用ffmpeg命令行实现录屏
View the version number of CUDA, pytorch, etc.
js中常用的几种遍历处理数据的方法梳理
typescript52-简化泛型函数调用
corn表达式 具体详解与案例
114. 如何通过单步调试的方式找到引起 Fiori Launchpad 路由错误的原因
typescript54 - generic constraints
做项目一定用得到的NLP资源【分类版】
【详细教程】一文参透MongoDB聚合查询
新一代服务网关Gateway的实践笔记
MPLS Comprehensive Experiment
typescript48-函数之间的类型兼容性