Presto编译安装和测试连接Hive

1.下载

源码:

 git clone https://github.com/prestodb/presto.git
 mvn clean install -DskipTests  

在Windows环境下编译报错未解决

在Linux环境下编译成功

2.安装

这里安装使用的不是自己编译的,而是安装官网文档操作,并下载的安装包。

注意:需要jdk版本 java 8 u92+,否则会报错

2.1 下载安装包

下载地址:https://repo1.maven.org/maven2/com/facebook/presto/presto-server/0.184/presto-server-0.184.tar.gz

CLI下载地址:https://repo1.maven.org/maven2/com/facebook/presto/presto-cli/0.184/presto-cli-0.184-executable.jar

2.2 解压

服务端

tar xvf presto-server-0.184.tar.gz

CLI

mv presto-cli-0.184-executable.jar presto
chmod +x presto

2.3 配置文件

在presto-server根目录,新建etc文件夹

mkdir etc

 新建节点配置etc/node.properties,添加如下内容

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

 新建jvm配置 etc/jvm.config,添加如下内容

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

 新建配置文件 etc/config.properties,内容如下

coordinator=true
node-scheduler.include-coordinator=true
http-server.http.port=8080
task.max-memory=1GB
discovery-server.enabled=true
discovery.uri=http://jiumei:8080

新建文件 etc/log.properties,内容如下

 com.facebook.presto=INFO

3. 启动和停止

启动

bin/launcher start

停止

bin/launcher stop

4.测试连接hive

 新建hive配置文件 etc/catalog/hive.properties,内容如下

connector.name=hive-hadoop2
hive.metastore.uri=thrift://master:9083

 测试

./presto --server localhost:8080 --catalog hive --schema default

 5.在Metabase中配置presto

Metabase支持的数据库中没有hive,但是在很多大数据分析场景下,数据存储是在hive中的。发现Metabase是支持Presto的,而Presto是支持Hive的,所以这里通过Presto连接Hive,再用Metabase访问Presto,就可以操作Hive的数据了。

配置连接信息,查看hive中的表。

猜你喜欢

转载自blog.csdn.net/zwahut/article/details/90638086