在 WSL2 Ubuntu 20.04 上安装 Presto

下载

下载 presto-server-0.272.tar.gz 到本地并解压

1
tar -zxvf presto-server-0.272.tar.gz -C ~

在 ./bashrc 里添加 Presto 环境变量 vim ~/.bashrc

1
2
3
## Presto env
export PRESTO_HOME=~/apps/presto-server-0.272
export PATH=$PATH:$PRESTO_HOME/bin

下载 presto-cli-0.272-executable.jar$PRESTO_HOME/bin 并改名为 ‘presto’

1
cp presto-cli-0.272-executable.jar presto

配置

基本按照官方文档.

创建 $PRESTO_HOME/etc 文件夹并在下面新建 node.properties 内容为:

1
2
3
node.environment=production
node.id=ffffffff-ffff-ffff-ffff-ffffffffffff
node.data-dir=/var/presto/data

新建 jvm.config 内容为:

1
2
3
4
5
6
7
8
-server
-Xmx16G
-XX:+UseG1GC
-XX:G1HeapRegionSize=32M
-XX:+UseGCOverheadLimit
-XX:+ExplicitGCInvokesConcurrent
-XX:+HeapDumpOnOutOfMemoryError
-XX:+ExitOnOutOfMemoryError

新建 config.properties 内容为:

1
2
3
4
5
6
7
8
coordinator=true
node-scheduler.include-coordinator=true
http-server.http.port=8082
query.max-memory=5GB
query.max-memory-per-node=1GB
query.max-total-memory-per-node=2GB
discovery-server.enabled=true
discovery.uri=http://localhost:8082

新建 log.properties 内容为:

1
com.facebook.presto=INFO

新建 $PRESTO_HOME/etc/catalog 文件夹并在下面新建 jmx.properties 内容为:

1
connector.name=jmx

新建 hive.properties 内容为:

1
2
connector.name=hive-hadoop2
hive.metastore.uri=thrift://localhost:9083

启动 Presto Server

后台启动:launcher start

前台启动: launcher run --verbose

查看状态:launcher status

停止:launcher stop

启动 Presto CLI

先启动 Hive Metastore 服务,然后启动 Presto CLI :

1
2
presto --server localhost:8082 --catalog hive --schema default
presto:default>