进入到/opt/module/presto目录,并创建存储数据文件夹
mkdir data
进入到/opt/module/presto目录,并创建存储配置文件文件夹
mkdir etc
配置在/opt/module/presto/etc目录下添加jvm.config配置文件
vim jvm.config
-server
-Xmx16G
-XX:+UseG1GC
-XX:G1HeapRegionSize=32M
-XX:+UseGCOverheadLimit
-XX:+ExplicitGCInvokesConcurrent
-XX:+HeapDumpOnOutOfMemoryError
-XX:+ExitOnOutOfMemoryError
Presto可以支持多个数据源,在Presto里面叫catalog,这里我们配置支持Hive的数据源,配置一个Hive的catalog
mkdir catalog
vim hive.properties
添加如下内容
connector.name=hive-hadoop2
hive.metastore.uri=thrift://hadoop2:9083
将hadoop2上的presto分发到hadoop3、hadoop4
分发之后,分别进入hadoop2、hadoop3、hadoop4三台主机的/opt/module/presto/etc的路径。配置node属性,node id每个节点都不一样。
[a@hadoop2 etc]$vim node.properties
node.environment=production
node.id=ffffffff-ffff-ffff-ffff-ffffffffffff
node.data-dir=/opt/module/presto/data
[a@hadoop3 etc]$vim node.properties
node.environment=production
node.id=ffffffff-ffff-ffff-ffff-fffffffffffe
node.data-dir=/opt/module/presto/data
[a@hadoop4 etc]$vim node.properties
node.environment=production
node.id=ffffffff-ffff-ffff-ffff-fffffffffffd
node.data-dir=/opt/module/presto/data
Presto是由一个coordinator节点和多个worker节点组成。在hadoop102上配置成coordinator,在hadoop103、hadoop104上配置为worker。
(1)hadoop102上配置coordinator节点
vim 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://hadoop102:8881
2)hadoop3、hadoop4上配置worker节点
vim config.properties
添加内容如下
coordinator=false
http-server.http.port=8881
query.max-memory=50GB
discovery.uri=http://hadoop2:8881
在hadoop102的/opt/module/hive目录下,启动Hive Metastore
nohup bin/hive --service metastore >/dev/null 2>&1 &
分别在hadoop2、hadoop3、hadoop4上启动Presto Server
$ bin/launcher run
$ bin/launcher start
日志查看路径/opt/module/presto/data/var/log
将presto-cli-0.196-executable.jar上传到hadoop102的/opt/module/presto文件夹下
修改文件名称
mv presto-cli-0.196-executable.jar prestocli
增加执行权限
chmod +x prestocli
./prestocli --server hadoop102:8881 --catalog hive --schema default
Presto命令行操作
Presto的命令行操作,相当于Hive命令行操作。每个表必须要加上schema。
例如:select * from schema.table limit 100
Presto可视化Client安装
1)将yanagishima-18.0.zip上传到hadoop102的/opt/module目录
2)解压缩yanagishima
$ unzip yanagishima-18.0.zip
cd yanagishima-18.0
3)进入到/opt/module/yanagishima-18.0/conf文件夹,编写yanagishima.properties配置
vim yanagishima.properties
jetty.port=7080
presto.datasources=atguigu-presto
presto.coordinator.server.atguigu-presto=http://hadoop2:8881
catalog.atguigu-presto=hive
schema.atguigu-presto=default
sql.query.engines=presto
4)在/opt/module/yanagishima-18.0路径下启动yanagishima
$ nohup bin/yanagishima-start.sh >y.log 2>&1 &
5)启动web页面
http://hadoop102:7080看到界面,进行查询了