您的位置:首页 > 其它

presto的安装与部署(对接kafka)

2016-01-12 23:19 686 查看


Preston 官网:http://prestodb.io/

Preston Github 主页:https://github.com/facebook/presto

一 安装环境

操作系统:CenteOs 6.6 
JDK 版本:1.8
ps: 本测试将presto的coordinator和worker都部署在一个节点上。

二 安装Presto

2.1 下载presto(版本0.1.0.5)压缩包并解压
wget https://repo1.maven.org/maven2/com/facebook/presto/presto-server/0.105/presto-server-0.105.tar.gz
tar -xf presto-server-0.105.tar.gz

进入plugin目录,查看支持的插件,这里主要测试kafka



2.2 配置presto

在安装目录下创建etc文件夹



2.2.1 配置node.properties
node.environment=test
node.id=ffffffff-ffff-ffff-ffff-ffffffffffff
node.data-dir=/var/presto/data


参数说明:
node.environment
:环境名称。一个集群节点中的所有节点的名称应该保持一致。
node.id
:节点唯一标识的名称。
node.data-dir
:数据和日志存放路径
2.2.2 配置jvm.config
-server
-Xmx4G
-XX:+UseConcMarkSweepGC
-XX:+ExplicitGCInvokesConcurrent
-XX:+AggressiveOpts
-XX:+HeapDumpOnOutOfMemoryError
-XX:OnOutOfMemoryError=kill -9 %p
2.2.3 配置
config.properties
 

coordinator=true
node-scheduler.include-coordinator=false
http-server.http.port=8001
task.max-memory=1GB
discovery-server.enabled=true
discovery.uri=http://10.199.xxx.xx:8001


参数说明:
coordinator
:Presto 实例是否以 coordinator 对外提供服务
node-scheduler.include-coordinator
:是否允许在 coordinator 上进行调度任务
http-server.http.port
:HTTP 服务的端口
task.max-memory=1GB
:每一个任务(对应一个节点上的一个查询计划)所能使用的最大内存
discovery-server.enabled
:是否使用 Discovery service 发现集群中的每一个节点。
discovery.uri
:Discovery server 的 url
2.2.4 配置log.properties
com.facebook.presto=INFO
设置某一个 java 包的日志等级
2.2.5 关于 Catalog 的配置(与kafka连接配置)
首先在etc下面建立catalog文件夹,新建kafka.properties文件,配置如下:
connector.name=kafka
kafka.table-names=table1,table2
kafka.nodes=host1:port,host2:port
具体配置参考http://prestodb-china.com/docs/current/connector/kafka.html

三 启动Presto

进入presto安装目录bin下面,利用help命令可以查看launcher的详细用法
launcher --help
以后台方式启动presto
launcher start
一般启动方式,且输出并打印日志
launcher run
停止presto
launcher stop



四 测试Presto CLI

下载Presto CLI
wget https://repo1.maven.org/maven2/com/facebook/presto/presto-cli/0.100/presto-cli-0.100-executable.jar[/code]将mv presto-cli-0.100-executable.jar重命名为presto 
mv presto-cli-0.100-executable.jar presto
将presto添加执行权限
chmod 777 presto
启动presto cli
./presto --server localhost:8001 --catalog kafka --schema default
执行show tables,如下



执行完show tables,查看 http://localhost:8001/ 页面:



五 错误处理

1 server refused connection



解决方案:检查presto是否启动,一般情况为presto没有启动

2
No worker nodes available



解决方案:在config.properties中设置node-scheduler.include-coordinator=true
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: