Presto叢集快速搭建

導讀:基於Hadoop構建資料倉庫,高效的查詢引擎能夠給幫助工作提升效率。目前主流Presto就是其中之一,應用場景有:臨時資料查詢、資料分析等。

1。 伺服器資訊

主機IP

主機名稱

可用記憶體

作用說明

xxx。xxx。xxx。93

presto1

70G

Coordinator、Worker

xxx。xxx。xxx。95

presto2

70G

Worker

xxx。xxx。xxx。100

presto3

70G

Worker

2。 環境要求

Linux or Mac OS X

Java 1。8。0_181, 64-bit

Python 2。4+

Host 叢集配置

3。 軟體下載

Presto Server:https://repo1。maven。org/maven2/io/prestosql/presto-server/303/presto-server-303。tar。gz

Presto Client:https://repo1。maven。org/maven2/io/prestosql/presto-cli/303/presto-cli-303-executable。jar

4。 軟體安裝

4。1 使用者建立

sudo useradd presto -msudo passwd presto #密碼與使用者名稱一樣

4。2 檔案上傳、解壓、建立

sudo tar -xvf presto-server-30x。tar。gzcd presto-server-30xsudo mkdir etcsudo mkdir etc/catalogsudo mkdir datasudo mkdir confsudo touch etc/node。properties etc/jvm。config etc/config。properties etc/log。propertiessudo touch etc/catalog/jmx。properties etc/catalog/hive。properties

4。3 node。properties配置

node。environment=presto_clusternode。id=主機名node。data-dir={presto_install_path}/data

4。4 jvm。properties配置

-server-Xmx32G-XX:+UseConcMarkSweepGC-XX:+ExplicitGCInvokesConcurrent-XX:+CMSClassUnloadingEnabled-XX:+AggressiveOpts-XX:+HeapDumpOnOutOfMemoryError-XX:OnOutOfMemoryError=kill -9 %p-XX:ReservedCodeCacheSize=150M

4。5 config。properties配置

coordinator=true #Coordinator節點配置,配置時註釋需換行node-scheduler。include-coordinator=true #Coordinator節點配置http-server。http。port=9999query。max-memory=200GBquery。max-memory-per-node=3GBdiscovery-server。enabled=true #Coordinator節點配置discovery。uri=http://[Coordinator節點主機名]:9999

4。6 log。properties配置

io。prestosql=INFO

4。7 jmx。properties配置

connector。name=jmx

4。8 hive。properties配置

connector。name=hive-hadoop2hive。metastore。uri=thrift://hive-metastore1:9083,thrift://hive-metastore2:9083hive。config。resources=${HIVE_HOME}/conf/core-site。xml,${HIVE_HOME}/conf/hdfs-site。xml

5 Running Presto

cd $PRESTO_HOME。/bin/launcher start #後臺執行。/bin/launcher run #前臺執行

6 Presto Client安裝

mv presto-cli-30x-executable。jar prestochmod +x presto。/presto ——server Coordinator節點主機名:9999 ——catalog hive ——schema default

7 效能測試(Hive VS Presto)

PV

UV

5563894

5435033

測試查詢SQL

Query1> select count(uuid) pv from dw_db。dw_product_safe_click_log_process where p_dt=‘2019-02-14’;Query2> select count(distinct uuid) uv from dw_db。dw_product_safe_click_log_process where p_dt=‘2019-02-14’;Query3> select count(uuid) pv,count(distinct uuid) uv from dw_db。dw_product_safe_click_log_process where p_dt=‘2019-02-14’;

查詢效能

查詢SQL

Hive

Presto

Query1

42。624 seconds

20 seconds

Query2

53。434 seconds

18 seconds

Query3

44。925 seconds

24 seconds

效能總結

1。 以上測試都線上下叢集進行測試(非安裝文件配置);2。 由於群集資源不穩定導致有些查詢理論應該時間更長,但由於資源因素導致混亂3。 總體來看Presto查詢效能比Hive查詢效能提升200%左右4。 後續等OLAP新伺服器到後再做實驗測試

8 資料參考

官網安裝文件:https://prestosql。io/docs/current/installation。html

Presto概況:https://prestodb。github。io/overview。html