当前位置:网站首页>即席查询——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键执行显示结果
边栏推荐
猜你喜欢
随机推荐
typescript52 - simplify generic function calls
Eight things to pay attention to in spot silver
中原银行实时风控体系建设实践
.NET Static Code Weaving - Rougamo Release 1.1.0
扩展卡尔曼滤波EKF
fsdbDump用法
2015年开源大事件汇总
虚拟机CentOS7中无图形界面安装Oracle
JVM垃圾回收总结(未完待续)
c语言分层理解(c语言操作符)
DataBinding下的RecycleView适配器Adapter基类
MATLAB三维绘图命令plot3入门
面试必问的HashCode技术内幕
typescript48 - type compatibility between functions
BGP实验(含MPLS)
NLP resources that must be used for projects [Classified Edition]
【详细教程】一文参透MongoDB聚合查询
哎,又跟HR在小群吵了一架!
2022-08-03: What does the following go code output?A: 2; B: 3; C: 1; D: 0.package main import "fmt" func main() { slice := []i
【性能优化】MySQL常用慢查询分析工具