prestodb安装配置 —参考prestodb官方文档配置
来源:互联网 发布:linux下安装bugzilla 编辑:程序博客网 时间:2024/03/28 17:49
tar zxvf presto-server-0.100
.tar.gz -C /usr/local/
ln -s /usr/local/presto-server-0.100/ /usr/local/prestodb
cd prestodb/
3. 配置 Presto
在 presto-server-0.100 目录创建 etc 目录,并创建以下文件:
node.properties
:每个节点的环境配置jvm.config
:jvm 参数config.properties
:配置 Presto Server 参数log.properties
:配置日志等级Catalog Properties
:Catalog 的配置
etc/node.properties
示例配置如下:
node.environment=productionnode.id=ffffffff-ffff-ffff-ffff-ffffffffffffnode.data-dir=/var/presto/data
参数说明:
node.environment
:环境名称。一个集群节点中的所有节点的名称应该保持一致。node.id
:节点唯一标识的名称。node.data-dir
:数据和日志存放路径。
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
包含 Presto Server 相关的配置,每一个 Presto Server 可以通时作为 coordinator 和 worker 使用。你可以将他们配置在一个极点上,但是,在一个大的集群上建议分开配置以提高性能。
coordinator 的最小配置:
coordinator=truenode-scheduler.include-coordinator=falsehttp-server.http.port=8080task.max-memory=1GBdiscovery-server.enabled=truediscovery.uri=http://cdh1:8080
worker 的最小配置:
coordinator=falsehttp-server.http.port=8080task.max-memory=1GBdiscovery.uri=http://cdh1:8080
可选的,作为测试,你可以在一个节点上同时配置两者:
coordinator=truenode-scheduler.include-coordinator=truehttp-server.http.port=8080task.max-memory=1GBdiscovery-server.enabled=truediscovery.uri=http://cdh1:8080
参数说明:
coordinator
:Presto 实例是否以 coordinator 对外提供服务node-scheduler.include-coordinator
:是否允许在 coordinator 上进行调度任务http-server.http.port
:HTTP 服务的端口task.max-memory=1GB
:每一个任务(对应一个节点上的一个查询计划)所能使用的最大内存discovery-server.enabled
:是否使用 Discovery service 发现集群中的每一个节点。discovery.uri
:Discovery server 的 url
etc/log.properties
可以设置某一个 java 包的日志等级:
com.facebook.presto=INFO
关于 Catalog 的配置,首先需要创建 etc/catalog 目录,然后根据你想使用的连接器来创建对应的配置文件,比如,你想使用 jmx 连接器,则创建 jmx.properties:
connector.name=jmx
如果你想使用 hive 的连接器,则创建 hive.properties:
connector.name=hive-cdh5hive.metastore.uri=thrift://cdh1:9083 #修改为 hive-metastore 服务所在的主机名称,这里我是安装在 cdh1节点hive.config.resources=/etc/hadoop/conf/core-site.xml,/etc/hadoop/conf/hdfs-site.xml
更多关于连接器的说明,请参考 Connectors 。
4. 运行 Presto
你可以使用下面命令后台启动:
bin/launcher start
也可以前台启动,观察输出日志:
bin/launcher run
另外,你也可以通过下面命令停止:
bin/launcher stop
更多命令,你可以通过 --help
参数来查看。
[root@cdh1 presto-server-0.100]# bin/launcher --helpUsage: launcher [options] commandCommands: run, start, stop, restart, kill, statusOptions: -h, --help show this help message and exit -v, --verbose Run verbosely --launcher-config=FILE Defaults to INSTALL_PATH/bin/launcher.properties --node-config=FILE Defaults to INSTALL_PATH/etc/node.properties --jvm-config=FILE Defaults to INSTALL_PATH/etc/jvm.config --config=FILE Defaults to INSTALL_PATH/etc/config.properties --log-levels-file=FILE Defaults to INSTALL_PATH/etc/log.properties --data-dir=DIR Defaults to INSTALL_PATH --pid-file=FILE Defaults to DATA_DIR/var/run/launcher.pid --launcher-log-file=FILE Defaults to DATA_DIR/var/log/launcher.log (only in daemon mode) --server-log-file=FILE Defaults to DATA_DIR/var/log/server.log (only in daemon mode) -D NAME=VALUE Set a Java system property
启动之后,你可以观察 /var/presto/data/ 目录:
[root@cdh1 /var/presto/data/]# tree.├── etc -> /opt/presto-server-0.90/etc├── plugin -> /opt/presto-server-0.90/plugin└── var ├── log │ ├── http-request.log │ ├── launcher.log │ └── server.log └── run └── launcher.pid5 directories, 4 files
在 /var/presto/data/var/log 目录可以查看日志:
launcher.log
:启动日志server.log
:Presto Server 输出日志http-request.log
:HTTP 请求日志
5. 测试 Presto CLI
Presto CLI为用户提供了一个用于查询的可交互终端窗口。CLI是一个 可执行 JAR文件, 这也就意味着你可以像UNIX终端窗口一样来使用CLI。
下载 presto-cli-0.100-executable.jar 并将其重命名为 presto-cli(你也可以重命名为 presto),然后添加执行权限。
运行下面命令进行测试:
wget https://repo1.maven.org/maven2/com/facebook/presto/presto-cli/0.100/presto-cli-0.100-executable.jar
[root@localhost prestodb]# ./presto-cli --server localhost:8080 --catalog hive --schema wwnpresto:wwn> show tables; Table -------- cm_vip (1 row)Query 20160226_064104_00021_92ghf, FINISHED, 1 nodeSplits: 2 total, 2 done (100.00%)0:00 [1 rows, 91B] [13 rows/s, 1.18KB/s]
presto:wwn> select * from cm_vip limit 3; vid | uid | username | begintime | endtime | edittime | viptype | aid | status | vipfrom | is_contpay | version | cid | o-----+---------+----------------+------------+------------+------------+---------+-----+--------+---------+------------+---------+-----+-- 1 | 1125693 | dggyth | 1333695600 | 1383062400 | 1383009369 | 2 | 1 | -1 | false | true | true | 0 | 2 | 153 | shibangjq | 1331791200 | 1363276800 | 1383030061 | 0 | 1 | -1 | false | true | true | 0 | 3 | 417604 | Kefidmachinery | 1438358400 | 1469980800 | 1438391633 | 2 | 1 | 1 | true | true | true | 0 | (3 rows)
在 执行 show tables 命令之前,你可以查看 http://cdh1:8080/ 页面:
可以运行
--help
命令查看更多参数,例如你可以在命令行直接运行下面命令:[root@localhost prestodb]# ./presto-cli --server localhost:8080 --catalog hive --schema wwn --execute "show tables;""cm_vip"
默认情况下,Presto 的查询结果是使用
less
程序分页输出的,你可以通过修改环境变量PRESTO_PAGER
的值将其改为其他命令,如more
,或者将其置为空以禁止分页输出。测试连接mysql:[root@localhost prestodb]# ./presto-cli --server localhost:8080 --catalog mysql --schema wwn
presto:wwn> show tables;
Table
--------------
cm_vip
pdcheck_hlbr
(2 rows)
Query 20160226_062024_00016_92ghf, FINISHED, 1 node
Splits: 2 total, 2 done (100.00%)
0:00 [2 rows, 116B] [22 rows/s, 1.26KB/s]6. 测试 jdbc
使用 jdbc 连接 Presto,需要下载 jdbc 驱动 presto-jdbc-0.100 并将其加到你的应用程序的 classpath 中。
支持以下几种 JDBC URL 格式:
jdbc:presto://host:portjdbc:presto://host:port/catalogjdbc:presto://host:port/catalog/schema
连接 hive 数据库中 sales 库,示例如下:
jdbc:presto://cdh1:8080/hive/sales
7. 总结
本文主要记录 Presto 的安装部署过程,并使用 hive-cdh5 连接器进行简单测试。下一步,需要基于一些生产数据做一些功能测试以及和 impala 做一些对比测试。
- prestodb安装配置 —参考prestodb官方文档配置
- prestoDB搭建小得
- Prestodb概述及性能测试
- 大数据查询引擎 PrestoDB
- PrestoDB 大数据查询引擎
- 安装配置mysql5.7非安装zip压缩包(参考官方文档最简单流程)
- Hbase-0.98.0全分布集群安装于配置(详细版参考自官方文档)
- Saltstack安装和基础配置官方文档
- MSA2000配置参考文档
- Azkaban2官方配置文档
- Azkaban2官方配置文档
- PrestoDB 来自Facebook的开源分布式查询引擎
- sparksql中的broadcast join和prestodb中的dynamic filter比较
- Ubuntu12.04 安装配置NFSv4的官方文档
- ubuntu 系统安装配置搭建jenkins(官方文档小结)
- web.xml 配置参考文档
- web.xml 配置参考文档
- hibernate 配置的参考文档
- Unexpected token u
- [leetcode] 266. Palindrome Permutation 解题报告
- ZOJ 3870
- 如何使用intelij IDEA 显示一个类的所有方法?与eclipse的outline视图类似
- iOS UIScrollView无法滑动/偏移的解决方法
- prestodb安装配置 —参考prestodb官方文档配置
- 著名的C++三大库boost、loki、stlport,及其他c++库应用简述
- iptables指令详解
- Android Design Support Library之TabLayout
- Java中的Timer源码分析及缺陷
- ECSHOP购物车商品自动清空问题解决方法改善会员体验
- JSTL标签EL表达式学习
- 微信企业号开发部分总结
- iOS程序猿之图片压缩