Presto 安装
- Presto Server 安装
- 解压到 `/opt/module` 目录
- 修改名称
- 创建存储数据文件夹
- 创建存储配置文件文件夹
- 添加jvm.config配置文件
- 配置支持 Hive 的数据源
- 分发
- 配置node属性
- cpu101
- cpu102
- cpu103
- 配置 coordinator 节点
- 配置 worker 节点
- 启动Hive Metastore
- 启动 Presto Server
- 脚本
- 权限
- 启动
- Presto 命令行 Client 安装
- 下载 Presto 的客户端
- 拷贝
- 修改文件名称
- 增加执行权限
- 启动 prestocli
- Presto命令行操作
- Presto 可视化 Client 安装
- 解压缩 `yanagishima`
- 配置文件
- 脚本
- 权限
- 启动web页面
- 查看表结构
Presto Server 安装
官网地址 : https://prestodb.github.io/
下载地址 : https://repo1.maven.org/maven2/com/facebook/presto/presto-server/
将 presto-server-0.196.tar.gz
导入cpu101 的 /opt/software
目录下
解压到 /opt/module
目录
1
2tar -zxvf presto-server-0.196.tar.gz -C /opt/module/
修改名称
1
2mv presto-server-0.196/ presto-0.196/
创建存储数据文件夹
进入到 /opt/module/presto-0.196
目录
1
2mkdir data
创建存储配置文件文件夹
进入到 /opt/module/presto-0.196
目录
1
2mkdir etc
添加jvm.config配置文件
配置在 /opt/module/presto-0.196/etc
目录下
1
2vim jvm.config
添加如下内容
1
2
3
4
5
6
7
8
9-server -Xmx16G -XX:+UseG1GC -XX:G1HeapRegionSize=32M -XX:+UseGCOverheadLimit -XX:+ExplicitGCInvokesConcurrent -XX:+HeapDumpOnOutOfMemoryError -XX:+ExitOnOutOfMemoryError
配置支持 Hive 的数据源
Presto 可以支持多个数据源 ( catalog )
配置支持 Hive 的数据源,配置一个 Hive 的 catalog
1
2mkdir catalog
1
2vim hive.properties
添加内容 :
1
2
3connector.name=hive-cpu101 hive.metastore.uri=thrift://cpu101:9083
分发
将 cpu101 上的 presto 分发到其他服务器
1
2xsync presto-0.196/
配置node属性
分发之后,分别进入cpu101、cpu102、cpu103三台主机的 /opt/module/presto-0.196/etc
的路径
cpu101
1
2vim node.properties
node id 每个节点都不一样
1
2
3
4node.environment=production node.id=ffffffff-ffff-ffff-ffff-ffffffffffff node.data-dir=/opt/module/presto-0.196/data
cpu102
1
2vim node.properties
1
2
3
4node.environment=production node.id=ffffffff-ffff-ffff-ffff-fffffffffffe node.data-dir=/opt/module/presto-0.196/data
cpu103
1
2vim node.properties
1
2
3
4node.environment=production node.id=ffffffff-ffff-ffff-ffff-fffffffffffd node.data-dir=/opt/module/presto-0.196/data
Presto 是由一个 coordinator 节点和多个 worker 节点组成
在 cpu101 上配置成 coordinator ,在 cpu102 、cpu103 上配置为 worker
配置 coordinator 节点
cpu101 上
1
2vim config.properties
添加内容如下
1
2
3
4
5
6
7coordinator=true node-scheduler.include-coordinator=false http-server.http.port=8881 query.max-memory=50GB discovery-server.enabled=true discovery.uri=http://cpu101:8881
配置 worker 节点
cpu102、cpu103 上
1
2vim config.properties
添加内容如下
1
2
3
4
5coordinator=false http-server.http.port=8881 query.max-memory=50GB discovery.uri=http://cpu101:8881
1
2vim config.properties
添加内容如下
1
2
3
4
5coordinator=false http-server.http.port=8881 query.max-memory=50GB discovery.uri=http://cpu101:8881
启动Hive Metastore
在cpu101 的 /opt/module/hive
目录下,用 cpu 角色
1
2nohup bin/hive --service metastore >/dev/null 2>&1 &
脚本启动 :
1
2hiveservices.sh start
启动 Presto Server
分别在 cpu101 、cpu102 、cpu103 上 , 前台启动Presto,控制台显示日志
1
2bin/launcher run
日志查看路径 /opt/module/presto/data/var/log
脚本
1
2vim presto_server.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28#!/bin/bash case $1 in "start"){ for i in cpu101 cpu102 cpu103 do echo ---------- Presto Server $i 启动 ------------ ssh $i "/opt/module/presto-0.196/bin/launcher start" done };; "stop"){ for i in cpu101 cpu102 cpu103 do echo ---------- Presto Server $i 停止 ------------ ssh $i "/opt/module/presto-0.196/bin/launcher stop" done };; "status"){ for i in cpu101 cpu102 cpu103 do echo ---------- Presto Server $i 状态 ------------ ssh $i "/opt/module/presto-0.196/bin/launcher status" done };; esac
权限
1
2chmod 777 presto_server.sh
启动
1
2presto_server.sh start
Presto 命令行 Client 安装
下载 Presto 的客户端
1
2https://repo1.maven.org/maven2/com/facebook/presto/presto-cli
将 presto-cli-0.196-executable.jar
上传到 cpu101 的 /opt/software
文件夹下
拷贝
1
2cp presto-cli-0.196-executable.jar /opt/module/presto-0.196/
修改文件名称
1
2mv presto-cli-0.196-executable.jar prestocli
增加执行权限
1
2chmod 777 prestocli
启动 prestocli
1
2./prestocli --server cpu101:8881 --catalog hive --schema default
Presto命令行操作
Presto的命令行操作 ( Hive 命令行操作 ) 。每个表必须要加上 schema
例子 :
1
2SELECT * FROM system.runtime."nodes" LIMIT 100;
Presto 可视化 Client 安装
将 yanagishima-18.0.zip
上传到 cpu101 的 /opt/software
目录
解压缩 yanagishima
下载 zip
1
2yum -y install zip unzip
1
2unzip yanagishima-18.0.zip -d /opt/module/
配置文件
进入到 /opt/module/yanagishima-18.0/conf
文件夹
编写yanagishima.properties
配置
1
2vim yanagishima.properties
添加如下内容
1
2
3
4
5
6
7jetty.port=7080 presto.datasources=cpu-presto presto.coordinator.server.cpu-presto=http://cpu101:8881 catalog.cpu-presto=hive schema.cpu-presto=default sql.query.engines=presto
脚本
1
2vim yanagishima.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56#!/bin/bash YANAGISHIMA_HOME=/opt/module/yanagishima-18.0 #检查进程是否运行正常,参数1为进程名 function check_process() { result=`ps -ef 2>/dev/null | grep -v grep | grep -i YanagishimaServer | wc -l` if [[ $result -lt 1 ]]; then echo "yanagishima 未在运行" else echo "yanagishima 正在运行" fi return $result } function yanagishima_start() { check_process if [[ $? -lt 1 ]]; then echo "启动 yanagishima " `cd $YANAGISHIMA_HOME;nohup bin/yanagishima-start.sh >y.log 2>&1 &` fi } function yanagishima_stop() { check_process if [[ $? -gt 0 ]]; then echo "停止 yanagishima " `ps -ef 2>/dev/null | grep -v grep | grep -i YanagishimaServer | awk '{print $2}' | xargs kill` fi } case $1 in "start") yanagishima_start ;; "stop") yanagishima_stop ;; "restart") yanagishima_stop sleep 2 yanagishima_start ;; "status") check_process ;; *) echo Invalid Args! echo 'Usage: '$(basename $0)' start|stop|restart|status' ;; esac
权限
1
2chmod 777 yanagishima.sh
启动web页面
http://cpu101:7080
看到界面,进行查询了
查看表结构
Tree View,可以查看所有表的结构 :
- Schema
- 表
- 字段
执行 ( ctrl + enter ):
1
2SELECT * FROM system.runtime."nodes" LIMIT 100
每个表后面都有个复制键,点一下会复制完整的表名
最后
以上就是超级便当最近收集整理的关于Presto 安装Presto Server 安装Presto 命令行 Client 安装Presto 可视化 Client 安装的全部内容,更多相关Presto内容请搜索靠谱客的其他文章。
发表评论 取消回复