4.7.1. # presto环境搭建¶
## 下载安装包 https://repo1.maven.org/maven2/com/facebook/presto/presto-server/0.233/presto-server-0.233.tar.gz
## 解压安装包 tar -zxvf presto-server-0.233.tar.gz -C /opt/module/
## 配置Presto 解压之后,在该文件夹下添加相应的配置:
在 presto-server-0.233 目录创建 etc 目录,并创建以下文件: node.properties:每个节点的环境配置 jvm.config:jvm 参数 config.properties:配置 Presto Server 参数 log.properties:配置日志等级 Catalog Properties:Catalog 的配置
### etc/node.properties 示例配置如下:
node.environment=production
node.id=ffffffff-ffff-ffff-ffff-ffffffffffff
node.data-dir=/var/presto/data
参数说明:
node.environment:环境名称。一个集群节点中的所有节点的名称应该保持一致。 node.id:节点唯一标识的名称。 node.data-dir:数据和日志存放路径。
### etc/jvm.config 示例配置如下:
`
-server
-Xmx12G
-XX:+UseConcMarkSweepGC
-XX:+ExplicitGCInvokesConcurrent
-XX:+CMSClassUnloadingEnabled
-XX:+AggressiveOpts
-XX:+HeapDumpOnOutOfMemoryError
-XX:OnOutOfMemoryError=kill -9 %p
-XX:ReservedCodeCacheSize=150M
`
### etc/config.properties 包含 Presto Server 相关的配置,每一个 Presto Server 可以通时作为 coordinator 和 worker 使用。
`
coordinator=true
node-scheduler.include-coordinator=true
http-server.http.port=8090
discovery-server.enabled=true
discovery.uri=http://cdh01:8090
`
参数说明:
coordinator:Presto 实例是否以 coordinator 对外提供服务 node-scheduler.include-coordinator:是否允许在 coordinator 上进行调度任务 http-server.http.port:HTTP 服务的端口 discovery-server.enabled:是否使用 Discovery service 发现集群中的每一个节点。 discovery.uri:Discovery server 的 url
### etc/log.properties 可以设置某一个 java 包的日志等级:
`
com.facebook.presto=INFO
`
### 使用 kudu 的连接器,则在 etc/catalog 创建 kudu.properties:
`
connector.name=kudu
kudu.client.master-addresses=cdh01:7051
`
## 启动presto
启动一下bin/launcher run,bin/launcher start可与后台运行
## 安装presto客户端
1. 下载: https://repo1.maven.org/maven2/com/facebook/presto/presto-cli/0.233/presto-cli-0.233-executable.jar 2. 上传Linux服务器上,重命名为presto: $mv presto-cli-0.233-executable.jar presto $chmod a+x presto 3. 执行以下命令: $ ./presto –server localhost:8090 –catalog kudu –schema default