Presto + Superset 数据仓库及BI

基于Presto和superset搭建数据分析平台。
Presto可以作为数据仓库,能够连接多种数据库和NoSql,同时查询性能很高;
Superset提供了Presto连接,方便数据可视化和dashboard生成。

基本概念

datawarehouse 数据仓库

整合各类数据库数据,面向主题,方便分析。存储元数据,模型信息,存储数据(建索引、缓存、分区、pre-aggregation)等。

  • greenplum
  • hive

OLAP

一些列数据分析操作,比如pivoting, slicing, dicing, drilling;可以分析数据仓库也可以甚至是文件数据。

  • Mondrian 开源的OLAP引擎
  • MOLAP 数据在DW,多维格式存储
  • ROLAP 数据存在数据库
  • 大数据领域很多sql-on-hadoop都可以看作OLAP引擎。Drill, Impala,Kylin,Phoenix,Druid,Greenplum,HAWQ,Pinot,Presto,SparkSql

MDX

OLAP的操作通常用MDX表达,查询多为数据库。OLAP服务会把MDX转为sql查询。

MPP: massive parallel processing

相对sql-on-hadoop,mpp架构不依赖hadoop/spark runtime,mpp具有原生的分布式执行引擎。

Presto w/ Hive and mysql

Presto属于MPP架构的分析性系统。官方介绍:

Presto is a tool designed to efficiently query vast amounts of data using distributed queries. ... Presto can be and has been extended to operate over different kinds of data sources including traditional relational databases and other data sources such as Cassandra.
Presto was designed to handle data warehousing and analytics: data analysis, aggregating large amounts of data and producing reports. These workloads are often classified as Online Analytical Processing (OLAP).

类似数据仓库,Presto可以关联分析多种数据源的数据,包括常见的关系型数据和大数据存储。

例子http://getindata.com/tutorial-presto-combine-data-hive-mysql-one-sql-like-query/

部署组件

  • download hadoop 2.6 (deploy hdfs)
  • hive 1.2.2 (deploy metaserver service)
  • mysql
  • deploy presto w/ catalog hive and mysql

测试数据

例子中通过Presto同时连接mysql和hive。mysql中存放结构化user信息,hive中存放日志数据。
Hive中数据量比较大,1915万行。

Mysql中900+行数据。

统计不同国家用户的访问量占比:

SELECT u.country, COUNT(*) AS cnt
             FROM hive.tutorial.stream s
             JOIN mysql.tutorial.user u
             ON s.userid = u.userid
             GROUP BY u.country

Superset

开源BI系统,B/S架构。

配置presto

presto://192.168.56.101:8080/hive/tutorial

sqllab

选择Presto作为Database,可以关联查询Presto catalog中的所有数据源。

posted @ 2018-08-17 15:11  wlu  阅读(6131)  评论(1编辑  收藏  举报