Presto学习(3)集群配置

由于公司的安规要求,不允许又第三方的聊天工具、云盘及笔记,导致有道云无法使用,故将有道云笔记整理发布在CSDN

Presto学习(2)为单机部署,由于网上有很多,故不在此重复发布了。

1.    环境基本要求:
a)    Linux or Mac OS X
b)    Java 8, 64-bit
c)    Python 2.4+
2.    集群规划(用的是3个虚拟机做集群配置测试,端口全部关闭):
a)    hdp1 (172.18.0.74) : 调度节点
b)    hdp2 (172.18.0.75) : worker节点
c)    hdp3 (172.18.0.76) : worker节点
3.    下载presto压缩包,下载地址https://repo1.maven.org/maven2/com/facebook/presto/presto-server/0.215/presto-server-0.215.tar.gz
4.    安装步骤(在/data1目录下操作):
a)    mkdir /presto
b)    mkdir /presto/data
c)    将presto-server-0.215.tar.gz复制到/presto
d)    unzip presto-server-0.215.tar.gz
e)    mv presto-server-0.215 presto-server
f)    cd /presto/presto-server
g)    mkdir /etc
h)    cd etc/
i)    touch config.properties jvm.config log.properties node.properties     //新建4个文件
j)    mkdir catalog                                                                                      //新建一个文件夹
k)    cd catalog
l)    touch jmx.properties hive.properties mysql.properties//新建3个文件(jmx.properties可有可无)
m)    对应的配置如下:
1.    config.properties(调节节点配置):
coordinator=true
node-scheduler.include-coordinator=false
http-server.http.port=8080
query.max-memory=50GB
query.max-memory-per-node=2GB
query.max-total-memory-per-node=6GB
discovery-server.enabled=true
discovery.uri=http://172.18.0.74:8080
2.    config.properties(worker节点配置):
coordinator=false
http-server.http.port=8080
query.max-memory=50GB
query.max-memory-per-node=2GB
query.max-total-memory-per-node=10GB
discovery.uri=http://172.18.0.74:8080
3.    jvm.config(jdk配置):
-server
-Xmx16G
-XX:+UseConcMarkSweepGC
-XX:+ExplicitGCInvokesConcurrent
-XX:+CMSClassUnloadingEnabled
-XX:+AggressiveOpts
-XX:+HeapDumpOnOutOfMemoryError
-XX:OnOutOfMemoryError=kill -9 %p
-XX:ReservedCodeCacheSize=150M
4.    log.properties(日志级别):
com.facebook.presto=DEBUG
5.    node.properties(node.id唯一,这个文件最好复制过去,改下id就好):
node.environment=test                           //集群的名称,其他机器要一模一样
node.id=a1                                      //节点id,唯一,每个节点的id都不能相同
node.data-dir=/presto/data                      //数据路径
6.    catalog文件夹里面的jmx.properties(这个配置文件可有可无):
connector.name=jmx
7.    hive.properties
connector.name=hive-hadoop2
hive.metastore.uri=thrift://172.18.0.74:9083
hive.config.resources=/etc/hadoop/conf/core-site.xml,/etc/hadoop/conf/hdfs-site.xml
hive.allow-drop-table=true
hive.storage-format=PARQUET
hive.metastore-cache-ttl=0s
hive.metastore-refresh-interval=1s
hive.max-partitions-per-writers=1000
8.    mysql.properties
connector.name=mysql
connection-url=jdbc:mysql://172.18.0.80:3306
connection-user=root
connection-password=root

n)    bin/launcher run    //前台启动方式   后台启动用:start
o)    按照测试步骤之后,打开浏览器:172.18.0.74:8080/ui/#/,如下图,就完成了
 
测试:
1.    下载 presto-cli-0.215-executable.jar:Presto CLI为用户提供了一个用于查询的可交互终端窗口。CLI是一个 可执行 JAR文件, 这也就意味着你可以像UNIX终端窗口一样来使用CLI ,下载地址(https://repo1.maven.org/maven2/com/facebook/presto/presto-cli/0.215/presto-cli-0.215-executable.jar)
2.    文件下载后,重名名为 presto-cli.jar, 使用 chmod +x 命令设置可执行权限:chmod +x presto-cli.jar
3.    命令:./presto-cli.jar --server 172.18.0.74:8080 --catalog hive --schema test_presto   (如果要调度,可加 --debug, 红色标识的项必须与 config.properties 配置文件中的uri 地址一致,配置的IP就用IP,机器名就用机器名)
4.    select * from system.runtime.nodes;             #查看当前集群各个节点状态 
如下:
 
hive:
 
presto:
 
简单条件查询测试5千万的数据,查询速度相差10倍以上。
附上配置文件,可以直接改改就用
配置参考来源:
https://yq.aliyun.com/articles/559015
https://blog.csdn.net/zyj8170/article/details/60954885
https://blog.csdn.net/lxhandlbb/article/details/77659400
https://yq.aliyun.com/ziliao/292265


遇到的问题:
1.    如果遇到discovery.uri的报错,则是地址有问题,建议用ip代替:
Cannot connect to discovery server for announce: Announcement failed with status code 404
2.    按照其他教材,如果有task.max-memory=1GB的配置,注意删除etc/config.properties中的task.max-memory=1GB,否则启动报如下错误:
 
3.    Cluster is still initializing, there are insufficient active worker nodes (0) to run query:集群正在初始化,稍等几分钟就好了
4.    进入hive,权限问题:su hdfs,就是普通权限

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值