Presto SQL/Trino安装

本文档详细介绍了如何下载并安装Trino服务器、客户端及JDBC驱动,包括设置文件数限制、安装JDK、创建用户、配置服务器参数如内存分配,并指导了如何启动Trino服务。此外,还展示了如何安装命令行工具,执行SQL查询。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.下载 https://trino.io/download.html

https://repo1.maven.org/maven2/io/trino/trino-server/359/trino-server-359.tar.gz 

https://repo1.maven.org/maven2/io/trino/trino-cli/359/trino-cli-359-executable.jar

https://repo1.maven.org/maven2/io/trino/trino-jdbc/359/trino-jdbc-359.jar

2. 安装文档

https://repo1.maven.org/maven2/io/trino/trino-docs/359/trino-docs-359.zip

3.安装

3.1放开打开文件数限制

[root@localhost ~]# vi /etc/security/limits.conf #添加如下行

* soft nofile 131072
* hard nofile 131072

3.2点下图红框处下载jdk

 https://www.azul.com/downloads/?package=jdk

3.3建用户
[root@localhost ~]# useradd trino
[root@localhost ~]# passwd trino

3.4使用trino安装jdk

[trino@localhost ~]$ cat .bash_profile

。。。。。。

export PATH=$PATH:$HOME/zulu11.48.21-ca-jdk11.0.11-linux_x64/bin
[trino@localhost ~]$
3.5安装Trino

解压:

tar -xzvf trino-server-359.tar.gz

建data目录:

[trino@localhost ~]$ ll
总用量 0
drwxr-xr-x.  2 trino trino 179 7月   9 16:08 pkg
drwxr-xr-x.  5 trino trino  74 7月   2 09:15 trino-server-359
drwxr-xr-x. 10 trino trino 175 4月   4 23:20 zulu11.48.21-ca-jdk11.0.11-linux_x64
[trino@localhost ~]$ mkdir trino-data
[trino@localhost ~]$ ll
总用量 0
drwxr-xr-x.  2 trino trino 179 7月   9 16:08 pkg
drwxrwxr-x.  2 trino trino   6 7月   9 16:10 trino-data
drwxr-xr-x.  5 trino trino  74 7月   2 09:15 trino-server-359
drwxr-xr-x. 10 trino trino 175 4月   4 23:20 zulu11.48.21-ca-jdk11.0.11-linux_x64
[trino@localhost ~]$

#建etc目录
[trino@localhost trino-server-359]$ pwd
/home/trino/trino-server-359
[trino@localhost trino-server-359]$ ll
总用量 208
drwxr-xr-x.  3 trino trino     84 7月   2 09:15 bin
drwxr-xr-x.  2 trino trino   8192 7月   2 09:17 lib
-rw-r--r--.  1 trino trino 190881 7月   2 09:17 NOTICE
drwxr-xr-x. 42 trino trino   4096 7月   2 09:15 plugin
-rw-r--r--.  1 trino trino    115 7月   2 09:17 README.txt
[trino@localhost trino-server-359]$ mkdir etc
[trino@localhost trino-server-359]$ ll
总用量 208
drwxr-xr-x.  3 trino trino     84 7月   2 09:15 bin
drwxrwxr-x.  2 trino trino      6 7月   9 16:14 etc
drwxr-xr-x.  2 trino trino   8192 7月   2 09:17 lib
-rw-r--r--.  1 trino trino 190881 7月   2 09:17 NOTICE
drwxr-xr-x. 42 trino trino   4096 7月   2 09:15 plugin
-rw-r--r--.  1 trino trino    115 7月   2 09:17 README.txt
[trino@localhost trino-server-359]$ cd etc
[trino@localhost etc]$


#建node.properties文件

[trino@localhost etc]$ pwd
/home/trino/trino-server-359/etc
[trino@localhost etc]$ cat node.properties
node.environment=production
node.id=trino01
node.data-dir=/home/trino/trino-data

[trino@localhost etc]$
 

#建个tmp目录/home/trino/trino-data/tmp,建个jvm.config文件

[trino@localhost etc]$ pwd
/home/trino/trino-server-359/etc
[trino@localhost etc]$ vi jvm.config
[trino@localhost etc]$ pwd
/home/trino/trino-server-359/etc
[trino@localhost etc]$ cat jvm.config
-server
-Xmx16G
-XX:-UseBiasedLocking
-XX:+UseG1GC
-XX:G1HeapRegionSize=32M
-XX:+ExplicitGCInvokesConcurrent
-XX:+ExitOnOutOfMemoryError
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-XX:ReservedCodeCacheSize=512M
-XX:PerMethodRecompilationCutoff=10000
-XX:PerBytecodeRecompilationCutoff=10000
-Djdk.attach.allowAttachSelf=true
-Djdk.nio.maxCachedBufferSize=2000000
-Djava.io.tmpdir=/home/trino/trino-data/tmp
[trino@localhost etc]$
 

#建config.properties文件
[trino@localhost etc]$ pwd
/home/trino/trino-server-359/etc
[trino@localhost etc]$ cat config.properties
coordinator=true
node-scheduler.include-coordinator=true
http-server.http.port=7000
query.max-memory=5GB
query.max-memory-per-node=1GB
query.max-total-memory-per-node=2GB
discovery.uri=http://172.30.3.243:7000

[trino@localhost etc]$


#建文件log.properties

[trino@localhost etc]$ pwd
/home/trino/trino-server-359/etc
[trino@localhost etc]$ cat log.properties
io.trino=INFO
[trino@localhost etc]$
 

#建catalog目录,建jmx.properties文件
[trino@localhost catalog]$ pwd
/home/trino/trino-server-359/etc/catalog
[trino@localhost catalog]$ cat jmx.properties
connector.name=jmx
[trino@localhost catalog]$

#启动,查看日志

#前台运行:bin/launcher run,后台运行:bin/launcher start

[trino@localhost trino-server-359]$ ./bin/launcher start
Started as 409869
[trino@localhost trino-server-359]$ cd ..
[trino@localhost ~]$ cd da
-bash: cd: da: 没有那个文件或目录
[trino@localhost ~]$ cd trino-data/
[trino@localhost trino-data]$ ll
总用量 0
lrwxrwxrwx. 1 trino trino 32 7月   9 17:00 etc -> /home/trino/trino-server-359/etc
lrwxrwxrwx. 1 trino trino 35 7月   9 17:00 plugin -> /home/trino/trino-server-359/plugin
drwxr-xr-x. 2 trino trino  6 7月   9 16:46 tmp
drwxrwxr-x. 4 trino trino 28 7月   9 17:00 var
[trino@localhost trino-data]$ cd var
[trino@localhost var]$ ll
总用量 0
drwxrwxr-x. 2 trino trino 68 7月   9 17:00 log
drwxrwxr-x. 2 trino trino 26 7月   9 17:00 run
[trino@localhost var]$ cd log
[trino@localhost log]$ ll
总用量 200
-rw-rw-r--. 1 trino trino   3132 7月   9 17:01 http-request.log
-rw-r--r--. 1 trino trino    508 7月   9 17:00 launcher.log
-rw-rw-r--. 1 trino trino 169099 7月   9 17:00 server.log
[trino@localhost log]$

4.安装命令行工具

4.1安装jdk8或以上版本

4.2 chmod u+x trino-cli-359-executable.jar

4.3执行sql

[trino@localhost pkg]$ ./trino-cli-359-executable.jar  --server localhost:7000 --catalog hive --schema default
trino:default> select 1;
 _col0
-------
     1
(1 row)

Query 20210710_081858_00003_hwrcx, FINISHED, 1 node
Splits: 1 total, 1 done (100.00%)
0.25 [0 rows, 0B] [0 rows/s, 0B/s]

trino:default>

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值