Persto搭建部署(亲测可用)

1.简介

jdk1.8支持persto-server-315及一下版本,315以上的版本需要jdk11.
本文使用jdk1.8并以persto-server-315作为示例。

2.安装包下载

  • 服务端

    https://repo1.maven.org/maven2/io/prestosql/presto-server/315/presto-server-315.tar.gz

  • 执行客户端

    https://repo1.maven.org/maven2/io/prestosql/presto-cli/315/presto-cli-315-executabl e.jar

3.配置

3.1.安装配置

  1. 将 presto-server-315.tar.gz 上传到服务器上,这里导入到 10.72.227.188 服务器上的 /opt/persto/目录下,并解压至 /persto/server/目录下

#tar -zvxf presto-server-315.tar.gz -C /persto/server/

  1. 创建persto数据目录(如果集群部署则每个节点都需要创建),用来存储log等文件

#mkdir -p /pub/presto

  1. 创建etc配置文件目录:在/opt/persto/server/presto-server-315目录下创建etc目录,用来存放persto所需的配置文件

[root@host-7 presto-server-315]# mkdir etc

3.2.server配置

persto-server启动需要node.properties、jvm.config、config.properties、log.properties以及连接数据源catalog配置(以下所有的配置都在3.1.3中的中创建的etc目录下)

3.2.1.node配置

etc下新建node.properties配置文件。

#环境名称,自己任取.集群中的所有 Presto 节点必须具有相同的环境名称.
node.environment=test
#支持字母,数字.对于每个节点,这必须是唯一的.这个标识符应该在重新启动或升级 Presto 时保持一致
node.id=1
#指定 presto 的日志和其它数据的存储目录,自己创建前面创建好的数据目录node.data-dir=/pub/persto

3.2.2.jvm配置

etc下新建jvm.config配置文件。参考官方给的配置,根据自身机器实际内存进行配置。

-server
#最大 jvm 内存
-Xmx16G
#指定 GC 的策略
-XX:+UseG1GC
-XX:G1HeapRegionSize=32M
-XX:+UseGCOverheadLimit
-XX:+ExplicitGCInvokesConcurrent
-XX:+HeapDumpOnOutOfMemoryError
-XX:+ExitOnOutOfMemoryError
-XX:ReservedCodeCacheSize=256M

3.2.3.config配置

#该节点是否作为 coordinator,如果是 true 就允许该 Presto 实例充当协调coordinator=true
#是否允许在协调器上调度工作(单节点为true,多节点为false)
node-scheduler.include-coordinator=false
#指定 HTTP 服务器的端口.Presto 使用 HTTP 进行所有内部和外部通信http-server.http.port=8080
#每个查询可以使用的最大分布式内存量
query.max-memory=50GB
#查询可在任何一台计算机上使用的最大用户内存量
query.max-memory-per-node=1GB
#查询可在任何一台计算机上使用的最大用户和系统内存量,其中系统内存是读取器,写入器和网络缓冲区等在执行期间使用的内存query.max-total-memory-per-node=2GB
#discover-server 是 coordinator 内置的服务,负责监听
workerdiscovery-server.enabled=true
#发现服务器的 URI.因为已经在 Presto 协调器中启用了 discovery,所以这应该是 Presto 协调器的 URI
discovery.uri=http://node01:8080

3.2.4.log配置

etc下新建log.properties配置文件。

com.facebook.presto=INFO

3.2.5.启动

#bin/launcher start

  • 在3.2.1中的node.data-dir配置的目录中查看启动日志确定persto服务是否启动成功
  • 使用jps命令查看PrestoServer是否存在
  • 通过ip:端口的方式访问到 presto 的 webui 界面

3.3.执行客户端配置

  • 将 presto-cli-315-executable.jar 上传至服务器,放在persto-server解压目录的bin目录下
  • 修改jar包名称为persto-cli

    #mv presto-cli-315-executable.jar presto-cli

  • 且给问价增加执行权限

    #chmod +x presto-cli

**使用:**连接具体的数据库

[root@node01 bin]$ ./presto --server node01:8080 --catalog hive (可选)–schema test (可选)–user xiaobai (可选)

3.4.catalog配置

3.4.1.mysql connector配置

etc目录下新建catalog目录。

#设置MySQL连接名称
connector.name=mysql
#设置MySQL连接地址
connection-url=jdbc:mysql://localhost:3306?characterEncoding=utf8&serverTimezone=UTC
#设置MySQL登录用户
connection-user=*****
#设置MySQL登录密码
connection-password=********

3.4.2.hive connector配置

新建hive.properties并添加配置(带kerberos认证)。
注意:
hive-hadoop2需要将hadoop的lzo包放到其插件下解决Unable to create input format org.apache.hadoop.mapred.TextInputFormat的问题。

connector.name=hive-hadoop2
hive.metastore.uri=thrift://host-2:9083
hive.metastore.authentication.type=KERBEROS
hive.metastore.service.principal=hive/_HOST@HYCLUSTER.COM
hive.metastore.client.principal=admin@HYCLUSTER.COM
hive.metastore.client.keytab=///admin.keytab
hive.hdfs.authentication.type=KERBEROS
#hive.hdfs.impersonation.enabled=true
hive.hdfs.presto.principal=admin@HYCLUSTER.COM
hive.hdfs.presto.keytab=///admin.keytab
hive.config.resources=///core-site.xml, ///hdfs-site.xml

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值