zoukankan      html  css  js  c++  java
  • Presto简介

    Presto简介

    Presto概念

    Presto是一个开源的分布式SQL查询引擎,数据量支持GB到PB字节,主要用来处理秒级查询的场景

    注意:虽然Presto可以解析SQL,但它不是一个标准的数据库。不是MySQL、Oracle的代替品,也不能直接用来处理在线事务(OLTP)

    Presto架构

    image-20210915164442148

    Presto的优缺点

    优点

    1. Presto基于内存计算,减少了硬盘IO,计算更快。
    2. 能够连接多个数据源,跨数据源连表查,如从Hive查询大量网络访问计算,然后从MySQL中匹配出设备信息。

    缺点

    Presto能够处理PB级别的海量数据分析,但Presto并不是把PB级数据都放在内存中计算的。而是根据场景,如Count,AVG等聚合运算,是边读数据边计算,在清内存,再读数据再计算,这种消耗的内存并不会很高。但是连表查,就可能产生大量的临时数据,因此速速就会变得很慢。

    Presto、Impala性能比较

    Presto、Impala性能比较

    Presto Server安装

    下载Presto安装包

    官方地址:https://prestodb.io/

    下载安装包 https://repo1.maven.org/maven2/com/facebook/presto/presto-server/0.219/presto-server-0.219.tar.gz

    解压

    tar -zxvf presto-server-0.219.tar.gz -C /data/soft/
    

    生成配置

    data用于存储日志、本地元数据等的数据目录。建议在安装目录外创建一个数据目录。方便后期Presto进行升级。

    mkdir /data/presto/data
    

    在安装目录中创建/etc文件夹,并创建以下配置

    文件名称 备注
    etc/node.properties 节点属性:特定于每个节点的环境配置
    etc/jvm.config JVM Config:Java虚拟机的命令选项
    etc/config.properties 配置属性:Presto服务器的配置
    etc/log.properties 日志级别配置文件
    • node.properties

      node.environment=production
      # 每一个节点的id必须唯一
      node.id=presto1
      node.data-dir=/opt/presto/data
      
    • JVM config

      -server
      -Xmx16G
      -XX:+UseG1GC
      -XX:G1HeapRegionSize=32M
      -XX:+UseGCOverheadLimit
      -XX:+ExplicitGCInvokesConcurrent
      -XX:+HeapDumpOnOutOfMemoryError
      -XX:+ExitOnOutOfMemoryError
      
    • config.properties(主节点)

      coordinator=true
      node-scheduler.include-coordinator=false
      http-server.http.port=8881
      query.max-memory=50GB
      discovery-server.enabled=true
      discovery.uri=http://bigdata02:8881
      
    • config.properties(从节点)

      coordinator=false
      http-server.http.port=8881
      query.max-memory=50GB
      discovery.uri=http://bigdata02:8881
      
    • log.properties

      com.facebook.presto = INFO
      
    • /etc/catalog/hive.properties

      # 创建catalog文件夹
      mkdir catalog
      # 创建hive.properties
      vi etc/catalog/hive.properties
      加入配置
      connector.name=hive-hadoop2
      hive.metastore.uri=thrift://bigdata02:9083   (替换为自己的hive metastore的ip和端口)
      hive.config.resources=/etc/hadoop/conf/core-site.xml,/etc/hadoop/conf/hdfs-site.xml  (可选,选择hdfs-site.xml和core-site.xml)
      

      启动Hive数据源

      nohup hive --service metastore  >/dev/null &   
      

      启动

      1. 前台启动(各个节点都需要执行启动脚本)
      bin/launcher run
      
      1. 后台启动(各个节点都需要执行启动脚本)
      bin/launcher start
      

      Presti 命令行Client安装

      下载Presto的客户端

      wget https://repo1.maven.org/maven2/com/facebook/presto/presto-cli/0.196/presto-cli-0.196-executable.jar
      

      修改后缀名称

      mv presto-cli-0.196-executable.jar prestocli
      

      添加执行权限

      chmod +x prestocli 
      

      启动prestocli

      ./prestocli --server bigdata02:8881 --catalog hive --schema default
      

      Presto命令行操作

      Presto的命令行操作,相当于Hive命令行操作。每个表必须加上schema

  • 相关阅读:
    网络设备安全需求规格
    web安全法则
    Write Hole 问题
    如何同步master的代码到fork分支代码
    Self assignment
    Uninitialized scalar variable
    Operands of different size in bitwise operation
    Insecure Compiler Optimization
    negative array index read
    Unintended sign extension
  • 原文地址:https://www.cnblogs.com/shine-rainbow/p/15273451.html
Copyright © 2011-2022 走看看