Trino安装部署
1.下载安装包
下载安装包
https://github.com/trinodb/
单独为Trino安装jdk
当前版本要求jdk11以上
下载jdk
open jdk11当前版本不能用,官网推荐使用 Azul Zulu
https://www.injdk.cn/
将zulu11.43.55-ca-jdk11.0.9.1-linux_x64.tar.gz上传到服务器
解压到**/opt/bigdata**目录
[along@hdp16 resource]$ tar -zxvf zulu11.43.55-ca-jdk11.0.9.1-linux_x64.tar.gz -C /opt/bigdata/
2.上传解压
[along@hdp16 resource]$ cd trino/
[along@hdp16 trino]$ ls
trino-cli-357-executable.jar trino-jdbc-357.jar trino-server-357.tar.gz
解压到/opt/bigdata
[along@hdp16 trino]$ tar -zxvf trino-server-357.tar.gz -C /opt/bigdata/
修改安装目录
[along@hdp16 bigdata]$ mv trino-server-357/ trino
为了方便后期升级,安装目录外创建文件夹
[along@hdp16 bigdata]$ mkdir trino-data
[along@hdp16 bigdata]$
安装目录内创建配置文件夹
[along@hdp16 bigdata]$ cd trino
[along@hdp16 trino]$ mkdir etc
3.配置
jdk配置
当前版本要求jdk11,单独为Trino配置
修改启动文件
[along@hdp16 bin]$ pwd
/opt/bigdata/trino/bin
[along@hdp16 bin]$ vim launcher
文件中添加如下内容
#替换成自己jdk的解压目录
PATH=/opt/bigdata/jdk-11/bin/:$PATH
java -version
配置文件node.properties
在新创建的etc目录下,创建节点配置文件node.properties
[along@hdp16 etc]$ vim node.properties
添加如下内容
node.environment=production
node.id=ffffffff-ffff-ffff-ffff-ffffffffffff
node.data-dir=/opt/bigdata/trino-data
配置文件jvm.conf
创建jvm.conf配置文件
[along@hdp16 etc]$ vim jvm.conf
添加如下内容
-server
-Xmx16G
-XX:-UseBiasedLocking
-XX:+UseG1GC
-XX:G1HeapRegionSize=32M
-XX:+ExplicitGCInvokesConcurrent
-XX:+ExitOnOutOfMemoryError
-XX:+HeapDumpOnOutOfMemoryError
-XX:ReservedCodeCacheSize=512M
-XX:PerMethodRecompilationCutoff=10000
-XX:PerBytecodeRecompilationCutoff=10000
-Djdk.attach.allowAttachSelf=true
-Djdk.nio.maxCachedBufferSize=2000000
-DHADOOP_USER_NAME=along
配置文件config.properties
创建节点配置文件config.properties
coordinator=true
node-scheduler.include-coordinator=true
http-server.http.port=8081
query.max-memory=5GB
query.max-memory-per-node=1GB
query.max-total-memory-per-node=2GB
discovery-server.enabled=true
discovery.uri=http://hdp16:8081
日志级别文件log.properties
创建日志级别文件log.properties
[along@hdp16 etc]$ vim log.properties
添加如下内容
io.trino=INFO
trino有四个级别:DEBUG、INFO、WARN和ERROR。
数据源目录
在etc目录下创建数据源文件夹
[along@hdp16 etc]$ pwd
/opt/bigdata/trino/etc
[along@hdp16 etc]$ mkdir catalog
hive数据源
在新建的catalog目录下,创建连接hive的配置文件
hive.properties
添加如下内容
connector.name=hive-hadoop2
hive.metastore.uri=thrift://hdp14:9083
hive.config.resources=/opt/bigdata/hadoop-3.1.4/etc/hadoop/core-site.xml,/opt/bigdata/hadoop-3.1.4/etc/hadoop/hdfs-site.xml
同步节点安装文件
同步安装文件夹到hdp17,hdp18
[along@hdp16 bigdata]$ cd /opt/bigdata
[along@hdp16 bigdata]$ scp -r trino along@hdp17:/opt/bigdata/
[along@hdp16 bigdata]$ scp -r trino along@hdp18:/opt/bigdata/
修改节点配置
连接hdp17,hdp18修改config.properties配置文件
coordinator=true
改为
coordinator=false
hdp17,hdp18修改节点id
hdp17修改
[along@hdp17 etc]$ pwd
/opt/bigdata/trino/etc
[along@hdp17 etc]$ vim node.properties
修改几点id为
node.id=ffffffff-ffff-ffff-ffff-fffffffffffg
hdp18修改
[along@hdp18 etc]$ vim node.properties
修改为
node.id=ffffffff-ffff-ffff-ffff-fffffffffffh
4.建集群启停脚本
创建集群启动脚本
#!/bin/bash
if [ $# -lt 1 ]
then
echo "No Args Input..."
exit ;
fi
function trino_fun()
{
echo " =================== hdp16 $1 Trino ==================="
ssh hdp16 "/opt/bigdata/trino/bin/launcher $1"
echo " =================== hdp17 $1 Trino ==================="
ssh hdp17 "/opt/bigdata/trino/bin/launcher $1"
echo " =================== hdp17 $1 Trino ==================="
ssh hdp18 "/opt/bigdata/trino/bin/launcher $1"
}
case $1 in
"start")
trino_fun start
;;
"stop")
trino_fun stop
;;
"status")
trino_fun status
;;
"restart")
trino_fun restart
;;
*)
echo "Input Args Error...start|stop|stattus|restart"
;;
esac
启动Trino集群
[along@hdp14 bigdata]$ trino.sh start
通过web页面查看,集群状态
http://hdp16:8081/

5.客户端配置
将上传的客户端jar包trino-cli-357-executable.jar,复制到**/opt/bigdata/trino**目录下
[along@hdp16 trino]$ cd /opt/resource/trino/
[along@hdp16 trino]$ cp trino-cli-357-executable.jar /opt/bigdata/trino
将客户端jar包重命名为trino
[along@hdp16 trino]$ cd /opt/bigdata/trino/
[along@hdp16 trino]$ ls
bin etc lib NOTICE plugin README.txt trino-cli-357-executable.jar
[along@hdp16 trino]$ mv trino-cli-357-executable.jar trino
添加执行权限
[along@hdp16 trino]$ chmod +x trino
启动客户端
./trino --server hdp16:8081 --catalog hive --schema default
执行查询语句
trino:default> show tables;
Table
----------------------
hive_hbase_emp_table
student
(2 rows)
Query 20210602_033249_00002_7tasy, FINISHED, 3 nodes
Splits: 53 total, 53 done (100.00%)
18.50 [2 rows, 61B] [0 rows/s, 3B/s]
trino:default>
6.可视化配置
下载编译
yanagishima 是一个针对Trino、Presto和hive的可视化工具,安装前需要编译
Web UI for Trino, Presto, Hive, Elasticsearch, SparkSQL
源码下载
https://github.com/yanagishima/
编译文档参考
https://blog.csdn.net/zhyajshhz/article/details/107630885
配置详解
https://yanagishima.github.io/yanagishima/config/
上传解压
将编译好的文件上传到**/opt/bigdata**
解压
[along@hdp16 bigdata]$ unzip yanagishima-18.0.zip
修改配置文件yanagishima.properties
[along@hdp16 conf]$ pwd
/opt/bigdata/yanagishima-18.0/conf
[along@hdp16 conf]$ vim yanagishima.properties
内容修改为
jetty.port=7080
presto.datasources=along-presto
presto.coordinator.server.along-presto=http://hdp16:8081
catalog.along-presto=hive
schema.along-presto=default
sql.query.engines=presto
8.0.zip
修改配置文件yanagishima.properties
```shell
[along@hdp16 conf]$ pwd
/opt/bigdata/yanagishima-18.0/conf
[along@hdp16 conf]$ vim yanagishima.properties
内容修改为
jetty.port=7080
presto.datasources=along-presto
presto.coordinator.server.along-presto=http://hdp16:8081
catalog.along-presto=hive
schema.along-presto=default
sql.query.engines=presto
yanagishima-18.0编译后的包,下载地址