FaceBook PrestoDB 安装文档

主要是根据官网内容配置,Presto详细的内容可参考官网

 

单机安装

1、下载presto-server-0.56.tar.gz,解压后在文件夹里创建etc目录

在etc下创建一下文件与目录:

config.properties : Presto 服务配置

jvm.config : Java虚拟机的命令行选项 
log.properties : 日志信息

node.properties : 环境变量配置,每个节点特定配置

catalog目录 : 每个连接者配置(data sources)

(1)相关文件配置信息

config.properties

coordinator=true
datasources=jmx,hive
http-server.http.port=8080
presto-metastore.db.type=h2
presto-metastore.db.filename=var/db/MetaStore
task.max-memory=1GB
discovery-server.enabled=true
discovery.uri=http://localhost:8080 

    datasources:指定多个catalog names,通过逗号分割,coordinator 与 workers均含有JMX来读取Java相关配置信息,另外可以配置hive等信息,当然coordinator最好不配置hive,减少协调器的负载

    http-server.http.port:Presto通过Http协议进行交互,则配置该端口进行信息交互

    presto-metastore.db.filename:Presto使用h2保存metadata,该配置是h2保存的本地文件存储

    task.max-memory:节点中任务使用最大的内存,该参数对查询操作有一定的约束

    discovery-server.enabled:Presto使用 Discovery service来定位集群中所有的节点。启动实例后向Discovery service注册。coordinator运行在嵌入式的Discovery service

    discovery.uri:Discovery server的URI,单机版配置自身就OK

 

jvm.config

-server
-Xmx16G
-XX:+UseConcMarkSweepGC
-XX:+ExplicitGCInvokesConcurrent
-XX:+CMSClassUnloadingEnabled
-XX:+AggressiveOpts
-XX:+HeapDumpOnOutOfMemoryError
-XX:OnOutOfMemoryError=kill -9 %p
-XX:PermSize=150M
-XX:MaxPermSize=150M
-XX:ReservedCodeCacheSize=150M
-Xbootclasspath/p:/home/hadoop/presto/lib/floatingdecimal-0.1.jar
-Dhive.config.resources=/home/hadoop/presto/etc/hadoop/conf/core-site.xml,/home/hadoop/presto/etc/hadoop/conf/hdfs-site.xml

 JVM相关参数配置,这些参数在编译时使用,不导入到shell,每个参数设置为一行,行尾切勿有空格

 

log.properties

com.facebook.presto=DEBUG

 配置日志等级,类似于log4j。四个等级: DEBUGINFOWARN , ERROR

 

 node.properties

 

node.environment=production
node.id=e256ec90-e1ef-4fc6-8eb0-378f58e05987
node.data-dir=/data2/presto/data
 node.environment:Presto的名称,所有节点在集群环境必须具有相同的名称

 

 node.id:安装的唯一标识,在每个节点必须唯一,若一台机器含有多个实例,则 其id是一致的,linux可使用uuidgen命令生成32位的UUID

 node.data-dir:本地文件路径,存放日志或其他数据

 

catalog目录

配置presto访问数据源的渠道

在etc目录下创建catalog目录

创建jmx.properties

 

connector.name=jmx
 创建hive.properties

 

 

connector.name=hive-hadoop1
hive.metastore.uri=thrift://localhost:9083
hive.config.resources=/home/hadoop/presto/etc/hadoop/conf/core-site.xml,/home/hadoop/presto/etc/hadoop/conf/hdfs-site.xml,/home/hadoop/presto/etc/hadoop/conf/mapred-site.xml
 connector.name:若hadoop集群是使用2.x系列,则为hive-cdh4,hive.metastore.uri则为hive server 后台进程,两种形式:

 

(1)metastore形式

 

hive --service metastore &
 默认端口是9083

 

(2)server形式

hive --service hiveserver -p 9083 &
 指定端口
配置完相关信息,则下载 presto-cli-0.56-executable.jar,presto交互接口,把jar包更名为presto(建议使用link方式)
启动presto服务
bin/launcher start 后台运行,日志信息为node.preperties配置的node.data-dir
run为前台运行,使用help查看更多的选项
常用(start/run/stop/restart)
使用jsp -ml 命令查看到,服务已经开启
29546 com.facebook.presto.server.PrestoServer
 打开交互接口
./presto --server localhost:8080 --catalog hive --schema default
 
presto:default> show tables;
                     Table                     
-----------------------------------------------                                                          
 cw_a                                          
 cw_b                                          
                           
 具体语法: http://prestodb.io/docs/current/sql.html
至今,单机部署成功。
2、集群配置
worker配置,即节点配置基本跟以上一致
(1)单独部署discovery server
解压后在discovery下新建etc目录,etc目录下创建以下文件

config.properties : Presto 服务配置

 

http-server.http.port=8411

 

jvm.config : Java虚拟机的命令行选项 

 

-server
-Xmx1G
-XX:+UseConcMarkSweepGC
-XX:+ExplicitGCInvokesConcurrent
-XX:+AggressiveOpts
-XX:+HeapDumpOnOutOfMemoryError
-XX:OnOutOfMemoryError=kill -9 %p

 

node.properties : 环境变量配置,每个节点特定配置

 

node.environment=production
node.id=ffffffff-ffff-ffff-ffff-ffffffffffff
node.data-dir=/data2/presto-server/data
 运行
bin/launcher start
 discovery运行与presto运行相似

 

查看进程

 

24064 io.airlift.discovery.server.DiscoveryServer
 

 

(2)修改presto的config.properties

coordinator节点

 

coordinator=true
discovery-server.enabled=true
discovery.uri=http://discovery.server.node.com:8411

worker节点

 

coordinator=false
#discovery-server.enabled=true
discovery.uri=http://discovery.server.node.com:8411
coordinator,worker节点配置修改为以上
(3)运行
  • 运行discovery-server
$DISCOVERY_SERVER_HOME/bin/launcher start
  • 运行presto实例
$PRESTO_HOME/bin/launcher start
  • 运行用户接口
./presto --server localhost:8080 --catalog hive --schema default

查看presto的log可以看到

discovery.uri连接信息:2014-01-11T13:36:30.120+0800     INFO   main    Bootstrap       discovery.uri                                     null      http://183.61.2.158:8411

hadoop配置相关信息:2014-01-11T13:36:30.120+0800     INFO   main    Bootstrap       hive.config.resources                             null      [/home/hadoop/presto/etc/hadoop/conf/core-site.xml, /home/hadoop/presto/etc/hadoop/conf/hdfs-site.xml]

配置的node.id:2014-01-11T13:36:30.123+0800     INFO   main    Bootstrap       node.id                                           null      e256ec90-e1ef-4fc6-8eb0-378f58e05987

hive-server信息:2014-01-11T13:36:30.120+0800     INFO   main    Bootstrap       hive.metastore.uri                                null      thrift://localhost:9083

 

成功启动的信息
2014-01-11T13:36:30.696+0800    DEBUG   main    com.facebook.presto.hive.RebindSafeMBeanServer  io.airlift.node:name=NodeInfo already bound to io.airlift.node.NodeInfo[io.airlift.node:name=NodeInfo]
2014-01-11T13:36:30.753+0800    DEBUG   main    com.facebook.presto.hive.RebindSafeMBeanServer  io.airlift.http.client:type=AsyncHttpClient,name=ForDiscoveryClient already bound to io.airlift.http.client.netty.NettyAsyncHttpClient[io.airlift.http.client:type=AsyncHttpClient,name=ForDiscoveryClient]
2014-01-11T13:36:30.755+0800    DEBUG   main    com.facebook.presto.hive.RebindSafeMBeanServer  io.airlift.discovery.client:name=ServiceInventory already bound to io.airlift.discovery.client.ServiceInventory[io.airlift.discovery.client:name=ServiceInventory]
2014-01-11T13:36:30.927+0800     INFO   main    io.airlift.bootstrap.LifeCycleManager   Life cycle starting...
2014-01-11T13:36:30.927+0800     INFO   main    io.airlift.bootstrap.LifeCycleManager   Life cycle startup complete. System ready.
2014-01-11T13:36:30.935+0800     INFO   main    com.facebook.presto.metadata.CatalogManager     Added catalog hive using connector hive-hadoop1
2014-01-11T13:36:30.939+0800     INFO   main    com.facebook.presto.metadata.CatalogManager     Added catalog jmx using connector jmx
2014-01-11T13:36:30.987+0800     INFO   main    com.facebook.presto.server.PrestoServer ======== SERVER STARTED ========

 

PrestoFacebook最新研发的数据查询引擎,可对250PB以上的数据进行快速地交互式分析。据称该引擎的性能是 Hive 的 10 倍以上。 PrestoDBFacebook 推出的一个大数据的分布式 SQL 查询引擎。可对从数 G 到数 P 的大数据进行交互式的查询,查询的速度达到商业数据仓库的级别。 Presto 可以查询包括 Hive、Cassandra 甚至是一些商业的数据存储产品。单个 Presto 查询可合并来自多个数据源的数据进行统一分析。 Presto 的目标是在可期望的响应时间内返回查询结果。Facebook 在内部多个数据存储中使用 Presto 交互式查询,包括 300PB 的数据仓库,超过 1000 个 Facebook 员工每天在使用 Presto 运行超过 3 万个查询,每天扫描超过 1PB 的数据。此外包括 Airbnb 和 Dropbox 也在使用 Presto 产品。 Presto 是一个分布式系统,运行在集群环境中,完整的安装包括一个协调器 (coordinator) 和多个 workers。查询通过例如 Presto CLI 的客户端提交到协调器,协调器负责解析、分析和安排查询到不同的 worker 上执行。 此外,Presto 需要一个数据源来运行查询。当前 Presto 包含一个插件用来查询 Hive 上的数据,要求: Hadoop CDH4 远程 Hive metastore service Presto 不使用 MapReduce ,只需要 HDFS 要求: Mac OS X or Linux Java 7, 64-bit Maven 3 (for building) Python 2.4 (for running with the launcher script) 标签:PrestoDB  查询引擎  大数据
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值