我是靠谱客的博主 超级便当,这篇文章主要介绍Presto 安装Presto Server 安装Presto 命令行 Client 安装Presto 可视化 Client 安装,现在分享给大家,希望可以做个参考。

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
2
tar -zxvf presto-server-0.196.tar.gz -C /opt/module/

在这里插入图片描述

修改名称

复制代码
1
2
mv presto-server-0.196/ presto-0.196/

在这里插入图片描述

创建存储数据文件夹

进入到 /opt/module/presto-0.196 目录

复制代码
1
2
mkdir data

在这里插入图片描述

创建存储配置文件文件夹

进入到 /opt/module/presto-0.196 目录

复制代码
1
2
mkdir etc

在这里插入图片描述

添加jvm.config配置文件

配置在 /opt/module/presto-0.196/etc 目录下

复制代码
1
2
vim 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
2
mkdir catalog

在这里插入图片描述

复制代码
1
2
vim hive.properties

在这里插入图片描述

添加内容 :

复制代码
1
2
3
connector.name=hive-cpu101 hive.metastore.uri=thrift://cpu101:9083

分发

将 cpu101 上的 presto 分发到其他服务器

复制代码
1
2
xsync presto-0.196/

在这里插入图片描述

配置node属性

分发之后,分别进入cpu101、cpu102、cpu103三台主机的 /opt/module/presto-0.196/etc 的路径

cpu101

复制代码
1
2
vim node.properties

在这里插入图片描述

node id 每个节点都不一样

复制代码
1
2
3
4
node.environment=production node.id=ffffffff-ffff-ffff-ffff-ffffffffffff node.data-dir=/opt/module/presto-0.196/data

cpu102

复制代码
1
2
vim node.properties
复制代码
1
2
3
4
node.environment=production node.id=ffffffff-ffff-ffff-ffff-fffffffffffe node.data-dir=/opt/module/presto-0.196/data

在这里插入图片描述

cpu103

复制代码
1
2
vim node.properties
复制代码
1
2
3
4
node.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
2
vim config.properties

添加内容如下

复制代码
1
2
3
4
5
6
7
coordinator=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
2
vim config.properties

添加内容如下

复制代码
1
2
3
4
5
coordinator=false http-server.http.port=8881 query.max-memory=50GB discovery.uri=http://cpu101:8881

在这里插入图片描述

复制代码
1
2
vim config.properties

添加内容如下

复制代码
1
2
3
4
5
coordinator=false http-server.http.port=8881 query.max-memory=50GB discovery.uri=http://cpu101:8881

在这里插入图片描述

启动Hive Metastore

在cpu101 的 /opt/module/hive 目录下,用 cpu 角色

复制代码
1
2
nohup bin/hive --service metastore >/dev/null 2>&1 &

脚本启动 :

复制代码
1
2
hiveservices.sh start

在这里插入图片描述

启动 Presto Server

分别在 cpu101 、cpu102 、cpu103 上 , 前台启动Presto,控制台显示日志

复制代码
1
2
bin/launcher run

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

日志查看路径 /opt/module/presto/data/var/log

在这里插入图片描述

脚本

复制代码
1
2
vim 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
2
chmod 777 presto_server.sh

在这里插入图片描述

启动

复制代码
1
2
presto_server.sh start

在这里插入图片描述

Presto 命令行 Client 安装

下载 Presto 的客户端

复制代码
1
2
https://repo1.maven.org/maven2/com/facebook/presto/presto-cli

presto-cli-0.196-executable.jar上传到 cpu101 的 /opt/software 文件夹下

在这里插入图片描述

拷贝

复制代码
1
2
cp presto-cli-0.196-executable.jar /opt/module/presto-0.196/

在这里插入图片描述

修改文件名称

复制代码
1
2
mv presto-cli-0.196-executable.jar prestocli

在这里插入图片描述

增加执行权限

复制代码
1
2
chmod 777 prestocli

在这里插入图片描述

启动 prestocli

复制代码
1
2
./prestocli --server cpu101:8881 --catalog hive --schema default

在这里插入图片描述

Presto命令行操作

Presto的命令行操作 ( Hive 命令行操作 ) 。每个表必须要加上 schema

例子 :

复制代码
1
2
SELECT * FROM system.runtime."nodes" LIMIT 100;

在这里插入图片描述

Presto 可视化 Client 安装

yanagishima-18.0.zip 上传到 cpu101 的 /opt/software 目录

在这里插入图片描述

解压缩 yanagishima

下载 zip

复制代码
1
2
yum -y install zip unzip

在这里插入图片描述

复制代码
1
2
unzip yanagishima-18.0.zip -d /opt/module/

在这里插入图片描述

配置文件

进入到 /opt/module/yanagishima-18.0/conf 文件夹

编写yanagishima.properties 配置

复制代码
1
2
vim yanagishima.properties

在这里插入图片描述

添加如下内容

复制代码
1
2
3
4
5
6
7
jetty.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
2
vim 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
2
chmod 777 yanagishima.sh

在这里插入图片描述

启动web页面

http://cpu101:7080

看到界面,进行查询了

在这里插入图片描述

查看表结构

Tree View,可以查看所有表的结构 :

  • Schema
  • 字段

在这里插入图片描述

执行 ( ctrl + enter ):

复制代码
1
2
SELECT * FROM system.runtime."nodes" LIMIT 100

在这里插入图片描述

每个表后面都有个复制键,点一下会复制完整的表名

在这里插入图片描述

最后

以上就是超级便当最近收集整理的关于Presto 安装Presto Server 安装Presto 命令行 Client 安装Presto 可视化 Client 安装的全部内容,更多相关Presto内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(60)

评论列表共有 0 条评论

立即
投稿
返回
顶部