presto安装及入门

19 篇文章 5 订阅

相比SparkSQL而言,Presto在查询性能上是优于SparkSQL的,同时对数据源的支持也是比SparkSQL丰富的。当然除了这两款OLAP外,还有impala,clickhouse,hawq,greenplum 等其他OLAP引擎,这些引擎都有各自的优势和适用场景

安装

#解压
tar -zxvf presto-server-0.236.tar.gz -C /usr/local
# 更名
mv presto-server-0.236.tar.gz presto
# 安装目录下创建etc目录
cd /usr/local/presto/ && mkdir etc
# 创建节点数据目录
mkdir data
# 

接下来创建配置文件

cd /usr/local/presto/etc
# config.properties  persto server的配置
cat << EOF > config.properties 
coordinator=true
node-scheduler.include-coordinator=true
http-server.http.port=8080
# 单个查询在整个集群上够使用的最大用户内存
query.max-memory=3GB
# 单个查询在每个节点上可以使用的最大用户内存
query.max-memory-per-node=1GB
# 单个查询在每个节点上可以使用的最大用户内存+系统内存(user memory: hash join,agg等,system memory:input/output/exchange buffers等)
query.max-total-memory-per-node=2GB
discovery-server.enabled=true
discovery.uri=http://0.0.0.0:8080
EOF

# node.properties 节点配置
cat << EOF > node.properties 
node.environment=production
node.id=node01
node.data-dir=/data
EOF

#jvm.config 配置,注意-DHADOOP_USER_NAME配置,替换为你需要访问hdfs的用户
cat << EOF > jvm.config 
-server
-Xmx3G
-XX:+UseG1GC
-XX:G1HeapRegionSize=32M
-XX:+UseGCOverheadLimit
-XX:+ExplicitGCInvokesConcurrent
-XX:+HeapDumpOnOutOfMemoryError
-XX:+ExitOnOutOfMemoryError
-DHADOOP_USER_NAME=root
EOF

#log.properties
#default level is INFO. `ERROR`,`WARN`,`DEBUG`
cat << EOF > log.properties
com.facebook.presto=INFO
EOF

# catalog配置,就是各种数据源的配置,我们使用hive,注意替换为你自己的thrift地址
mkdir /usr/local/presto/etc/catalog
cat <<EOF > catalog/hive.properties
connector.name=hive-hadoop2
# 换成你自己metastore地址
hive.metastore.uri=thrift://192.168.xx.101:9083
hive.parquet.use-column-names=true
hive.allow-rename-column=true
hive.allow-rename-table=true
EOF

# 添加hudi支持,下载hudi的jar包到当前路径
hudi-presto-bundle-0.5.2-incubating.jar

# 客户端安装
cd /usr/local/presto
wget presto-cli-0.236-executable.jar

mv presto-cli-0.236-executable.jar presto
chmod u+x presto
ln -s /usr/local/presto/presto /usr/bin/presto  
# 设置环境变量
vim /etc/profile
export PRESTO_HOME=/usr/local/presto
export PATH=$PRESTO_HOME/bin:$PATH
# 激活环境变量
source  /etc/profile

使用

# 启动
launcher start

启动之后用jps查看,可以看到一个进程

 PrestoServer

presto连接hive,前提hive的metastore要是启动好的

hive --service metastore &

之后presto就可以连接hive了,会进入presto的命令行,就可以使用sql命令进行查询

[root@mypc01 presto]# ./presto --server 192.168.xx.101:8080 --catalog hive
presto> show schemas;
       Schema
--------------------
 default
 information_schema
 emp

注意事项

如果报错

 failed: Failed connecting to Hive metastore: [192.168.xx.101:9083]

请确认metastore是否启动

hive --service metastore &
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值