Presto集群部署和配置


參考文檔:1.https://blog.csdn.net/zzq900503/article/details/79403949 prosto部署與連接hive使用
                2. http://my.525.life/article?id=1510739741953 CDH目錄結構
                    3. https://ilnba.iteye.com/blog/1711367    linux文件描述限制
 
環境准備
Presto 有以下幾個基本要求: 
Linux 或者 Mac OS X 系統 
Java 8,64位

我的環境
操作系統:CentOS Linux release 7.3.1611 (Core)
Hadoop集群:CDH 5.15.2, Parcel
jdk版本:java version 1.8.0_111

Presto單節點安裝配置

首先下載presto,本次我下載的最新的版0.218,  https://repo1.maven.org/maven2/com/facebook/presto/presto-server/,后來啟動報錯需要jdk1.85以上,所以換成0.195,
1 wget https://repo1.maven.org/maven2/com/facebook/presto/presto-server/0.195/presto-server-0.195.tar.gz 
2 tar zxvf presto-server-0.195.tar.gz 
3 mv presto-server-0.195 /opt/presto

配置Presto
在安裝目錄中創建一個etc的目錄,在etc中配置一下配置信息:
JVM 配置:JVM的命令行選項
配置屬性:Presto server的配置信息
Catalog屬性:configuration forConnectors(數據源)的配置信息

Node Properties

vim etc/node.properties
#輸入配置
node.environment=production
node.id=a001  #集群節點node.id不能相同
node.data-dir=/var/presto/data
JVM配置(Presto集群coordinator和worker的JVM配置是一致的)
vim  etc/jvm.config
#添加如下配置輸入配置:
-server
-Xmx16G
-XX:+UseG1GC
-XX:G1HeapRegionSize=32M
-XX:+UseGCOverheadLimit
-XX:+ExplicitGCInvokesConcurrent
-XX:+HeapDumpOnOutOfMemoryError
-XX:+ExitOnOutOfMemoryError

Config Properties

vim etc/config.properties
#輸入配置:
coordinator=true #是否作為coordinator,worker節點為false
node-scheduler.include-coordinator=false  #是否允許在coordinator上調度節點只負責調度時node-scheduler.include-coordinator設置為false,調度節點也作為worker時node-scheduler.include-coordinator設置為true
http-server.http.port=8080 #指定HTTP server 端口。Presto通過HTTP協議進行所有的內部和外部通信
query.max-memory=50GB
query.max-memory-per-node=1GB
query.max-total-memory-per-node=2GB
discovery-server.enabled=true          #Presto 通過Discovery 服務來找到集群中所有的節點
discovery.uri=http://cdh-1.digidite.com:8080  #coordinator的URL

日志級別
vim etc/log.properties
#輸入配置:
com.facebook.presto=INFO

Catalog Properties
mkdir etc/catalog
vim  etc/catalog/hive.properties
#輸入配置:
connector.name=hive-hadoop2
hive.metastore.uri=thrift://cdh-1:9083

啟動運行Presto
后台啟動: 
bin/launcher start
或者前台啟動:
bin/launcher run
 (輸出日志方便查看啟動問題)
停止:
bin/launcher stop
 
查看進程:
jps
輸出進程:
137442 PrestoServer
停止:
bin/launcher stop

啟動完之后,日志將會寫在/var/presto/data/var/log目錄下:
launcher.log: 這個日志文件由launcher創建,並且server的stdout和stderr都被重定向到了這個日志文件中。 這份日志文件中只會有很少的信息,包括:在server日志系統初始化的時候產生的日志和JVM產生的診斷和測試信息。
server.log: 這個是Presto使用的主要日志文件。一般情況下,該文件中將會包括server初始化失敗時產生的相關信息。這份文件會被自動輪轉和壓縮。
http-request.log: 這是HTTP請求的日志文件,包括server收到的每個HTTP請求信息,這份文件會被自動輪轉和壓縮。

連接hive測試驗證
下載 presto-cli-0.100-executable.jar:Presto CLI為用戶提供了一個用於查詢的可交互終端窗口。
https://repo1.maven.org/maven2/com/facebook/presto/presto-cli/0.195/presto-cli-0.195-executable.jar
 
mv presto-cli-0.195-executable.jar /opt/presto/presto
使用presto連接hive:
./presto --server cdh-1:8080 --catalog hive --schema hivedemo_1
.....
presto:test> show schemas from hive;
....
presto:hivedemo_1> show tables from hive.hivedemo_1;
....
 
在hive中查一下hive default庫中的表 ,hive自帶了一個thrift的客戶端———-beeline ,打開beeline ,使用命令
beeline
連接hiveserver2,使用命令
!connect jdbc:hive2://cdh-1:10000
輸入當前linux用戶名和密碼后,正常連接后會出現0: jdbc:hive2://cdh-1:10000>
這時可以嘗試操作數據庫,使用命令:
show tables;
結果如下
 
 

Presto多節點安裝配置

集群節點分配:
cdh-1 (10.215.43.1):coordinator調度節點
cdh-2 (10.215.43.2):worker節點
cdh-3 (10.215.43.3):worker節點

節點部署
將cdh-1部署配置好的打包傳到worker節點
scp cdh-1:/opt/presto.zip /opt/

配置修改
node properties
vim etc/node.properties
內容如下:
node.environment=production
node.id=a002    #每個節點需要不同
node.data-dir=/var/presto/data
 

Config Properties
vim etc/config.properties
內容如下:
coordinator=false   #work節點需要填寫false
node-scheduler.include-coordinator=true
http-server.http.port=8080
query.max-memory=50GB
query.max-memory-per-node=1GB
discovery-server.enabled=true
discovery.uri=http://cdh-1:8080
作為work時,coordinator配置應為false
discovery.uri與coordinator調度節點的ip對應。
調度節點只負責調度時node-scheduler.include-coordinator設置為false
調度節點也作為worker時node-scheduler.include-coordinator設置為true

啟用與使用

啟動方式與單點的一樣,每台都啟動起來即可使用。

管理

 

presto提供了Web的管理界面,可以查看多節點的情況。 
根據端口來訪問,比如8080,則訪問 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM