一、集成之前
1、启动mysql
service mysql start
2、登录mysql并查看相关信息
[[email protected] bin]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 79
Server version: 5.6.47 MySQL Community Server (GPL)
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| hive |
| ke |
| mysql |
| performance_schema |
| test |
+--------------------+
6 rows in set (0.03 sec)
mysql>
二、集成Mysql
1、创建mysql.properties
在presto所有节点/opt/softWare/presto/ln_presto/etc/catalog下创建mysql.properties文件
connector.name=mysql
connection-url=jdbc:mysql://192.168.230.21:3306?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&failOverReadOnly=false
connection-user=root
connection-password=123456
2、重启presto
所有节点重启presto
./launcher restart
3、presto连接mysql
[[email protected] bin]# ./presto --server 192.168.230.21:8099 --catalog=mysql --schema=test
presto:test> show tables;
Table
-------------------
stu
stuinfo
walk_info
(9 rows)
Query 20201117_080742_00001_ks5bu, FINISHED, 3 nodes
Splits: 36 total, 36 done (100.00%)
0:04 [9 rows, 227B] [2 rows/s, 58B/s]
presto:test> select * from walk_info;
user | counttime | walkplace | newwalknum
-----------+---------------------+------------+------------
zhangSan | 2020-07-02 13:44:43 | 操场西南门 | 1
liSi | 2020-07-02 13:44:45 | 操场西南门 | 3
wangWu | 2020-07-02 13:44:47 | 操场东北门 | 3
xiaoQiang | 2020-07-02 13:44:49 | 操场西北门 | 2
zhangSan | 2020-07-02 13:44:51 | 操场西门 | 3
liSi | 2020-07-02 13:44:53 | 操场东南门 | 1
wangWu | 2020-07-02 13:44:55 | 操场东南门 | 3
xiaoQiang | 2020-07-02 13:44:57 | 操场西门 | 1
zhangSan | 2020-07-02 13:44:59 | 操场北门 | 1
(9 rows)
Query 20201117_081619_00005_ks5bu, FINISHED, 2 nodes
Splits: 17 total, 17 done (100.00%)
0:00 [9 rows, 0B] [31 rows/s, 0B/s]
presto:test>
test为mysql中的一个库;
