presto0.169版本对postgresql9.6.9支持还可以,高版本就不行了
1.建用户
[root@localhost ~]# useradd presto
[root@localhost ~]# passwd presto
2.安装jdk8
[presto@localhost ~]$ cat .bash_profile
。。。。。。
export PATH=$PATH:$HOME/jdk1.8.0_291/bin
[presto@localhost ~]$
3.下载prestodb Presto: Free, Open-Source SQL Query Engine for any Data
https://repo1.maven.org/maven2/com/facebook/presto/presto-server/0.169/presto-server-0.169.tar.gz
https://repo1.maven.org/maven2/com/facebook/presto/presto-cli/0.169/presto-cli-0.169-executable.jar
https://repo1.maven.org/maven2/com/facebook/presto/presto-jdbc/0.169/presto-jdbc-0.169.jar
--安装文档
https://repo1.maven.org/maven2/com/facebook/presto/presto-docs/0.169/presto-docs-0.169.zip
4.tar -xzvf presto-server-0.169.tar.gz
5.presto-server-0.169下建data目录
[presto@localhost presto-server-0.169]$ ll
总用量 208
drwxr-xr-x. 3 presto presto 84 3月 16 2017 bin
drwxrwxr-x. 2 presto presto 6 7月 10 17:52 data
drwxr-xr-x. 3 presto presto 109 7月 10 18:00 etc
drwxr-xr-x. 2 presto presto 8192 3月 16 2017 lib
-rw-r--r--. 1 presto presto 191539 3月 16 2017 NOTICE
drwxr-xr-x. 21 presto presto 4096 3月 16 2017 plugin
-rw-r--r--. 1 presto presto 119 3月 16 2017 README.txt
6.presto-server-0.169下建etc目录及如下文件
[presto@localhost presto-server-0.169]$ ll etc
总用量 16
drwxr-xr-x. 2 presto presto 28 7月 10 17:49 catalog
-rw-r--r--. 1 presto presto 240 7月 10 17:59 config.properties
-rw-r--r--. 1 presto presto 171 7月 10 17:56 jvm.config
-rw-r--r--. 1 presto presto 25 7月 10 18:00 log.properties
-rw-r--r--. 1 presto presto 98 7月 10 17:53 node.properties
[presto@localhost presto-server-0.169]$ ll etc/catalog/
总用量 4
-rw-r--r--. 1 presto presto 19 7月 10 17:49 jmx.properties
[presto@localhost presto-server-0.169]$ cd etc
[presto@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
discovery-server.enabled=true
discovery.uri=http://172.30.3.243:7000
[presto@localhost etc]$ cat jvm.config
-server
-Xmx16G
-XX:+UseG1GC
-XX:G1HeapRegionSize=32M
-XX:+UseGCOverheadLimit
-XX:+ExplicitGCInvokesConcurrent
-XX:+HeapDumpOnOutOfMemoryError
-XX:+ExitOnOutOfMemoryError
[presto@localhost etc]$ cat log.properties
com.facebook.presto=INFO
[presto@localhost etc]$ cat node.properties
node.environment=production
node.id=presto01
node.data-dir=/home/presto/presto-server-0.169/data
[presto@localhost etc]$ cat catalog/jmx.properties
connector.name=jmx
[presto@localhost etc]$
6.mysql5和mysql8兼容的驱动版本:
mysql-connector-java-5.1.48.jar,放到目录下 $HOME/presto-server-0.169/plugin/mysql/
替换原来的驱动
6.#启动,查看日志
#前台运行:bin/launcher run,后台运行:bin/launcher start
[presto@localhost presto-server-0.169]$ cd data/
[presto@localhost data]$ ll
总用量 0
lrwxrwxrwx. 1 presto presto 36 7月 10 18:10 etc -> /home/presto/presto-server-0.169/etc
lrwxrwxrwx. 1 presto presto 39 7月 10 18:10 plugin -> /home/presto/presto-server-0.169/plugin
drwxrwxr-x. 4 presto presto 28 7月 10 18:10 var
[presto@localhost data]$ cd var/
[presto@localhost var]$ ll
总用量 0
drwxrwxr-x. 2 presto presto 26 7月 10 18:10 log
drwxrwxr-x. 2 presto presto 26 7月 10 18:10 run
[presto@localhost var]$ ll log/
总用量 4
-rw-r--r--. 1 presto presto 68 7月 10 18:10 launcher.log
[presto@localhost var]$ ll run
总用量 4
-rw-------. 1 presto presto 7 7月 10 18:10 launcher.pid
[presto@localhost var]$
7.命令行客户端
[presto@localhost ~]$ ./presto-cli-0.169-executable.jar --server localhost:7000 --catalog hive --schema default
presto:default> select 1;
_col0
-------
1
(1 row)
Query 20210710_115444_00002_ugrzu, FINISHED, 1 node
Splits: 17 total, 17 done (100.00%)
0:00 [0 rows, 0B] [0 rows/s, 0B/s]
presto:default>
7.jdbc连接时,用户就填主机用户:presto
8.配置pgsql数据源
[presto@localhost catalog]$ pwd
/home/presto/presto-server-0.169/etc/catalog
[presto@localhost catalog]$ ll
总用量 8
-rw-r--r--. 1 presto presto 19 7月 10 19:38 jmx.properties
-rw-rw-r--. 1 presto presto 133 7月 10 20:29 pgsql172_30_3_243.properties
[presto@localhost catalog]$ cat pgsql172_30_3_243.properties
connector.name=postgresql
connection-url=jdbc:postgresql://172.30.3.243:5432/pgdb01
connection-user=pgsql
connection-password=123456
[presto@localhost catalog]$
9.查询
select * from pgsql172_30_3_243.public.table01;