天天看點

(三)presto內建Mysql一、內建之前二、內建Mysql

一、內建之前

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中的一個庫;

(三)presto內建Mysql一、內建之前二、內建Mysql

繼續閱讀