presto的安裝與部署(對接kafka)
阿新 • • 發佈:2019-01-02
一 安裝環境
作業系統: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.3 配置-server -Xmx4G -XX:+UseConcMarkSweepGC -XX:+ExplicitGCInvokesConcurrent -XX:+AggressiveOpts -XX:+HeapDumpOnOutOfMemoryError -XX:OnOutOfMemoryError=kill -9 %p
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
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