presto的安裝與部署(對接kafka)

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
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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章