Hello Presto

◎ 架构

◎ 安装前提

按照 http://prestodb.io/overview.html 其中要求jdk必须是1.8, 否则启动会报错版本不匹配.

◎ 配置文件

在presto-server安装目录下新建etc目录, 并新建以下配置文件和catalog目录


配置文件


配置项


config.properties


coordinator=true

datasources=jmx

node-scheduler.include-coordinator=true

http-server.http.port=8080

task.max-memory=1GB

discovery-server.enabled=true

discovery.uri=http://localhost:8080


Presto 服务配置


jvm.config


-server

-Xmx4G

-XX:+UseConcMarkSweepGC

-XX:+ExplicitGCInvokesConcurrent

-XX:+CMSClassUnloadingEnabled

-XX:+AggressiveOpts

-XX:+HeapDumpOnOutOfMemoryError

-XX:OnOutOfMemoryError=kill -9 %p

-XX:PermSize=150M

-XX:MaxPermSize=150M

-XX:ReservedCodeCacheSize=150M


JVM命令行选项


log.properties


com.facebook.presto=INFO


日志信息


node.properties


node.environment=production

node.id=ffffffff-ffff-ffff-ffff-ffffffffffff

node.data-dir=/home/hadoop/data/presto/data


环境变量配置,每个节点特定配置


catalog/jmx.properties


connector.name=jmx


每个连接者配置(data sources)

数据源可以选择jmx, hive等. 如果在这里配置了hive, 则要在catalog目录下新建一个hive.properties文件

http://yugouai.iteye.com/blog/2002504 这篇博客里由两个配置在新版本中不支持

presto-metastore.db.type=h2

presto-metastore.db.filename=var/db/MetaStore

◎ 启动presto-server

[email protected]:~/soft/presto-server-0.89$ bin/launcher run

启动的过程报如下错, 这个暂时发现对下面的试验没有影响

2015-01-09T10:03:27.784+0800
ERROR
Discovery-0
io.airlift.discovery.client.CachingServiceSelector
Cannot connect to discovery server for refresh (collector/general): Lookup of collector failed for http://localhost:8080/v1/service/collector/general

2015-01-09T10:03:27.800+0800
ERROR
Discovery-0
io.airlift.discovery.client.CachingServiceSelector
Cannot connect to discovery server for refresh (presto/general): Lookup of presto failed for http://localhost:8080/v1/service/presto/general

◎ 命令行接口

http://prestodb.io/docs/current/installation/cli.html

[email protected]:~/install/bigdata/nosql$ ln -s presto-cli-0.89-executable.jar presto-cli

jmx connection

http://prestodb.io/docs/current/connector/jmx.html

[email protected]:~/install/bigdata/nosql$ ./presto-cli --server localhost:8080 --catalog jmx --schema jmx

bash: ./presto-cli: 权限不够

[email protected]:~/install/bigdata/nosql$ chmod 755 presto-cli*

[email protected]:~/install/bigdata/nosql$ ./presto-cli --server localhost:8080 --catalog jmx --schema jmx

presto:jmx> SHOW TABLES FROM jmx.jmx;

Table

--------------------------------------------------------------------------------------

com.facebook.presto.execution:name=nodescheduler

com.facebook.presto.execution:name=queryexecution

com.facebook.presto.execution:name=querymanager

com.facebook.presto.execution:name=remotetaskfactory

com.facebook.presto.execution:name=taskexecutor

com.facebook.presto.execution:name=taskmanager

presto:jmx> SELECT node, vmname, vmversion

-> FROM jmx.jmx."java.lang:type=runtime";

node                 |              vmname               | vmversion

--------------------------------------+-----------------------------------+-----------

ffffffff-ffff-ffff-ffff-ffffffffffff | Java HotSpot(TM) 64-Bit Server VM | 25.25-b02

(1 row)

Query 20150109_022500_00003_nex2n, FINISHED, 1 node

Splits: 2 total, 2 done (100.00%)

0:00 [1 rows, 78B] [7 rows/s, 623B/s]

presto:jmx> SELECT openfiledescriptorcount, maxfiledescriptorcount

-> FROM jmx.jmx."java.lang:type=operatingsystem";

openfiledescriptorcount | maxfiledescriptorcount

-------------------------+------------------------

564 |                   4096

(1 row)

Query 20150109_022517_00004_nex2n, FINISHED, 1 node

Splits: 2 total, 2 done (100.00%)

0:00 [1 rows, 16B] [14 rows/s, 238B/s]

[email protected]:~/install/bigdata/nosql$ jps -lm

9890 ./presto-cli --server localhost:8080 --catalog jmx --schema jmx

10469 sun.tools.jps.Jps -lm

9002 com.facebook.presto.server.PrestoServer

点击第一个Job

hive connection

http://prestodb.io/docs/current/connector/hive.html

[email protected]:~/soft/presto-server-0.89/etc$ cat config.properties

coordinator=true

datasources=jmx,hive

node-scheduler.include-coordinator=true

http-server.http.port=8080

task.max-memory=1GB

discovery-server.enabled=true

discovery.uri=http://localhost:8080

[email protected]:~/soft/presto-server-0.89/etc$ cat catalog/hive.properties

connector.name=hive-cdh5

hive.metastore.uri=thrift://localhost:9083

[email protected]:~/soft/cdh5.2.0/hive-0.13.1-cdh5.2.0/conf$ tail -f hive-site.xml

<property>

<name>hive.metastore.uris</name>

<value>thrift://localhost:9083</value>

</property>

</configuration>

启动hive-meta和hive-server2

hive --service hiveserver2 &

hive --service metastore &

[email protected]:~/install/bigdata/nosql$ ./presto-cli --server localhost:8080 --catalog hive --schema default

presto:default> DESCRIBE hive.saledata.tbldate;  
==> saledata表示hive中的database

Column    |  Type   | Null | Partition Key | Comment

--------------+---------+------+---------------+---------

dateid       | varchar | true | false         |

theyearmonth | varchar | true | false         |

theyear      | varchar | true | false         |

themonth     | varchar | true | false         |

thedate      | varchar | true | false         |

theweek      | varchar | true | false         |

theweeks     | varchar | true | false         |

thequot      | varchar | true | false         |

thetenday    | varchar | true | false         |

thehalfmonth | varchar | true | false         |

(10 rows)

Query 20150109_072540_00010_scd3k, FINISHED, 1 node

Splits: 2 total, 2 done (100.00%)

0:00 [10 rows, 2.03KB] [51 rows/s, 10.4KB/s]

presto:default> select * from hive.saledata.tbldate;

dateid   | theyearmonth | theyear | themonth | thedate | theweek | theweeks | thequot | thetenday | thehalfmonth

------------+--------------+---------+----------+---------+---------+----------+---------+-----------+--------------

2003-1-1   | 200301       | 2003    | 1        | 1       | 3       | 1        | 1       | 1         | 1

2003-1-2   | 200301       | 2003    | 1        | 2       | 4       | 1        | 1       | 1         | 1

2003-1-3   | 200301       | 2003    | 1        | 3       | 5       | 1        | 1       | 1         | 1

2003-1-4   | 200301       | 2003    | 1        | 4       | 6       | 1        | 1       | 1         | 1

2003-1-5   | 200301       | 2003    | 1        | 5       | 7       | 1        | 1       | 1         | 1

2003-1-6   | 200301       | 2003    | 1        | 6       | 1       | 2        | 1       | 1         | 1

presto:default> select count(*) from hive.saledata.tbldate;

_col0

-------

4383

(1 row)

Query 20150109_072649_00012_scd3k, FINISHED, 1 node

Splits: 2 total, 2 done (100.00%)

0:00 [4.38K rows, 172KB] [23.5K rows/s, 922KB/s]

presto:default>

对比hive使用count(*)查询

hive> use saledata;

hive> desc tbldate;

OK

dateid              
string

theyearmonth        
string

theyear             
string

themonth            
string

thedate             
string

theweek             
string

theweeks            
string

thequot             
string

thetenday           
string

thehalfmonth        
string

Time taken: 0.075 seconds, Fetched: 10 row(s)

hive> select count(*) from tbldate;

Total jobs = 1

Launching Job 1 out of 1

Number of reduce tasks determined at compile time: 1

In order to change the average load for a reducer (in bytes):

set hive.exec.reducers.bytes.per.reducer=<number>

In order to limit the maximum number of reducers:

set hive.exec.reducers.max=<number>

In order to set a constant number of reducers:

set mapreduce.job.reduces=<number>

Starting Job = job_1420787592849_0001, Tracking URL = http://localhost:8088/proxy/application_1420787592849_0001/

Kill Command = /home/hadoop/soft/cdh5.2.0/hadoop-2.5.0-cdh5.2.0/bin/hadoop job  -kill job_1420787592849_0001

Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 1

2015-01-09 15:27:16,054 Stage-1 map = 0%,  reduce = 0%

2015-01-09 15:27:21,318 Stage-1 map = 100%,  reduce = 0%, Cumulative CPU 1.03 sec

2015-01-09 15:27:27,555 Stage-1 map = 100%,  reduce = 100%, Cumulative CPU 2.49 sec

MapReduce Total cumulative CPU time: 2 seconds 490 msec

Ended Job = job_1420787592849_0001

MapReduce Jobs Launched:

Stage-Stage-1: Map: 1  Reduce: 1   Cumulative CPU: 2.49 sec   HDFS Read: 176119 HDFS Write: 5 SUCCESS

Total MapReduce CPU Time Spent: 2 seconds 490 msec

OK

4383

Time taken: 21.025 seconds, Fetched: 1 row(s)

可以看出21s/173ms ≈ 21s/210ms=100倍

TODO...

时间: 2024-08-29 02:39:01

Hello Presto的相关文章

SQL数据分析概览——Hive、Impala、Spark SQL、Drill、HAWQ 以及Presto+druid

转自infoQ! 根据 O'Reilly 2016年数据科学薪资调查显示,SQL 是数据科学领域使用最广泛的语言.大部分项目都需要一些SQL 操作,甚至有一些只需要SQL. 本文涵盖了6个开源领导者:Hive.Impala.Spark SQL.Drill.HAWQ 以及Presto,还加上Calcite.Kylin.Phoenix.Tajo 和Trafodion.以及2个商业化选择Oracle Big Data SQL 和IBM Big SQL,IBM 尚未将后者更名为"Watson SQL&q

Presto源码解读1-客户端提交查询-吕信(原创)

客户端请求处理就是接收交互式/非交互式命令,通过httpclient发送到服务器(coordinator),客户端通过httpclient更新执行状态打印给用户看,最后收集结果打印给用户.启动Presto cli 客户端的代码文件为: presto-cli\src\main\java\com\facebook\presto\cli\Presto.java public final class Presto { private Presto() {} public static void main

Presto使用JDBC链接集群代码-吕信(原创)

----------------------------------------------程序1: 遍历某个表---------------------------------------------- package jd.com.dawn; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.util.TimeZone; import com.

环境搭建 Hadoop+Hive(orcfile格式)+Presto实现大数据存储查询一

一.前言 以下简介摘自官方 Hadoop简介 Hadoop就是一个实现了Google云计算系统的开源系统,包括并行计算模型Map/Reduce,分布式文件系统HDFS,以及分布式数据库Hbase,同时Hadoop的相关项目也很丰富,包括ZooKeeper,Pig,Chukwa,Hive,Hbase,Mahout,flume等.接下来我们使用的是Hive Hive简介 Hive 是一个基于 Hadoop的开源数据仓库工具,用于存储和处理海量结构化数据.    它把海量数据存储于 hadoop 文件

#数据技术选型#即席查询Shib+Presto,集群任务调度HUE+Oozie

郑昀 创建于2014/10/30 最后更新于2014/10/31 一)选型:Shib+Presto 应用场景:即席查询(Ad-hoc Query) 1.1.即席查询的目标 使用者是产品/运营/销售运营的数据分析师: 要求数据分析师掌握查询SQL查询脚本编写技巧,掌握不同业务的数据存储在不同的数据集市里: 不管他们的计算任务是提交给 数据库 还是 Hadoop,计算时间都可能会很长,不可能在线等待: 所以, 使用者提交了一个计算任务(PIG/SQL/Hive SQL),控制台告知任务已排队,给出大

presto集群安装&整合hive|mysql|jdbc

Presto是一个运行在多台服务器上的分布式系统. 完整安装包括一个coordinator(调度节点)和多个worker. 由客户端提交查询,从Presto命令行CLI提交到coordinator. coordinator进行解析,分析并执行查询计划,然后分发处理队列到worker中. 目录: 搭建前环境准备 集群计划 连接器 安装步骤 配置文件 运行presto 整合hive测试 整合mysql测试 整合jdbc测试 1.搭建前环境准备 CentOS 6.7 java8 Python3.4.4

大数据系列之分布式大数据查询引擎Presto

关于presto部署及详细介绍请参考官方链接 http://prestodb-china.com PRESTO是什么? Presto是一个开源的分布式SQL查询引擎,适用于交互式分析查询,数据量支持GB到PB字节. Presto的设计和编写完全是为了解决像Facebook这样规模的商业数据仓库的交互式分析和处理速度的问题. 它可以做什么? Presto支持在线数据查询,包括Hive, Cassandra, 关系数据库以及专有数据存储. 一条Presto查询可以将多个数据源的数据进行合并,可以跨越

Presto实现原理和美团的使用实践

[转载]http://tech.meituan.com/presto.html Facebook的数据仓库存储在少量大型Hadoop/HDFS集群.Hive是Facebook在几年前专为Hadoop打造的一款数据仓库工具.在以前,Facebook的科学家和分析师一直依靠Hive来做数据分析.但Hive使用MapReduce作为底层计算框架,是专为批处理设计的.但随着数据越来越多,使用Hive进行一个简单的数据查询可能要花费几分到几小时,显然不能满足交互式查询的需求.Facebook也调研了其他比

Presto架构及原理

Presto 是 Facebook 推出的一个基于Java开发的大数据分布式 SQL 查询引擎,可对从数 G 到数 P 的大数据进行交互式的查询,查询的速度达到商业数据仓库的级别,据称该引擎的性能是 Hive 的 10 倍以上.Presto 可以查询包括 Hive.Cassandra 甚至是一些商业的数据存储产品,单个 Presto 查询可合并来自多个数据源的数据进行统一分析.Presto 的目标是在可期望的响应时间内返回查询结果,Facebook 在内部多个数据存储中使用 Presto 交互式

【Hadoop】Flink VS Spark?Drill VS Presto?

参考资料: drill 官网:http://drill.apache.org/ drill安装使用:https://segmentfault.com/a/1190000002652348 drill简介:http://www.csdn.net/article/2012-08-20/2808871 SQL ON Hadoop框架:http://www.infoq.com/cn/news/2014/06/sql-on-hadoop/ http://www.wtoutiao.com/a/3153648