1
- # install
1
+ This repository contains a simple [ Trino] ( https://trino.io ) event listener
2
+ plugin for persisting information on completed queries to a database table.
2
3
3
- build plugin:
4
+ Currently, only MySQL is supported but support for other database systems
5
+ could be easily added if anyone is interested since [ Flyway] ( https://flywaydb.org )
6
+ is used for database migrations.
7
+
8
+ # Installation
9
+
10
+ ## From release
11
+
12
+ 1 . Download the release ZIP from the releases page
13
+ 2 . unzip file and copy folder to Trino plugin directory
14
+ 3 . Create a database/schema in MySQL:
15
+ ```
16
+ create database trino_db_event_listener;
17
+ ```
18
+ 4 . create an ` event-listener.properties ` file with contents like:
19
+ ```
20
+ event-listener.name=db-event-listener
21
+ db-listener.url=jdbc:mysql://localhost:3306/trino_db_event_listener
22
+ db-listener.user=trino
23
+ db-listener.password=trino
24
+ ```
25
+ 5 . restart Trino
26
+
27
+ ## From Source
28
+
29
+ Checkout and build the plugin:
4
30
5
31
```
6
32
mvn clean install -DskipTests
7
33
```
8
34
9
- unzip folder and copy to trino plugin folder
35
+ This will create a folder in the ` target ` directory. Copy this folder to
36
+ the Trino plugin folder:
10
37
11
38
```
12
- cp -R trino-simple-db-logger-376 /path/to/trino/folder/plugin
39
+ cp -R target/ trino-simple-db-logger-376 /path/to/trino/folder/plugin
13
40
```
14
41
15
- create schema
42
+ Create a database/ schema in MySQL:
16
43
17
44
```
18
45
create database trino_db_event_listener;
46
+ ```
19
47
20
- create `event-listener.properties` file:
48
+ Create an ` event-listener.properties ` file with contents like :
21
49
22
50
```
23
51
event-listener.name=db-event-listener
@@ -26,11 +54,11 @@ db-listener.user=trino
26
54
db-listener.password=trino
27
55
```
28
56
29
- restart trino
30
-
31
- verify plugin is loaded and table got created in mysql
57
+ Finally, restart trino. Once Trino is up and running, verify the plugin is
58
+ loaded and the ` queries ` table was created in MySQL.
32
59
33
- if working correctly, will see the following in the Trino `server.log` file:
60
+ If the plugin is working correctly, you will see the following in the Trino
61
+ ` server.log ` file:
34
62
35
63
```
36
64
2022-04-29T16:03:11.763-0400 INFO main io.trino.eventlistener.EventListenerManager -- Loading event listener etc/event-listener.properties --
0 commit comments