presto 连接hive

修改hive-site.xml增加

<property>
<name>hive.metastore.local</name>
<value>false</value>
</property>

<property>
<name>hive.metastore.uris</name>
<value>thrift://localhost:9083</value>
</property>

启动

hive --service hiveserver2 &
hive --service metastore &

presto配置

cd /usr/local/opt/presto/etc
vim config.properties

datasources=mysql,hive
coordinator=true
node-scheduler.include-coordinator=true
http-server.http.port=8888
query.max-memory=5GB
query.max-memory-per-node=1GB
discovery-server.enabled=true
discovery.uri=http://localhost:8888

//修改presto hive配置
vim catalog/hive.properties

connector.name=hive-hadoop2
hive.metastore.uri=thrift://localhost:9083
hive.config.resources=/usr/local/opt/hadoop/libexec/etc/hadoop/core-site.xml,/usr/local/opt/hadoop/libexec/etc/hadoop/conf/hdfs-site.xml
hive.allow-drop-table=true

启动presto服务

/usr/local/opt/presto/bin/presto-server start

连接测试

presto --server localhost:8888 --catalog hive --schema default

presto:default> show tables;
 Table
-------
 test
(1 row)

Query 20180626_111942_00005_arqn2, FINISHED, 1 node
Splits: 18 total, 18 done (100.00%)
0:00 [1 rows, 21B] [2 rows/s, 59B/s]

推荐阅读更多精彩内容