MySQL event listener#
The MySQL event listener plugin allows streaming of query events to an external MySQL database. The query history in the database can then be accessed directly in MySQL or via Trino in a catalog using the MySQL connector.
This event listener is a first step to store the query history of your Trino cluster. The query events can provide CPU and memory usage metrics, what data is being accessed with resolution down to specific columns, and metadata about the query processing.
Running the capture system separate from Trino reduces the performance impact and avoids downtime for non-client-facing changes.
You need to perform the following steps:
Create a MySQL database.
Determine the JDBC connection URL for the database.
Ensure network access from the Trino coordinator to MySQL is available. Port 3306 is the default port.
To configure the MySQL event listener plugin, create an event listener properties
mysql-event-listener.properties with the following contents
as an example:
mysql-event-listener.db.url defines the connection to a MySQL database
available at the domain
example.net on port 3306. You can pass further
parameters to the MySQL JDBC driver. The supported parameters for the URL are
documented in the MySQL Developer
in Config properties:
If another event listener is already configured, add the new value
etc/mysql-event-listener.properties with a separating comma.
After this configuration and successful start of the Trino cluster, the table
trino_queries is created in the MySQL database. From then on, any query
processing event is captured by the event listener and a new row is inserted
into the table. The table includes many columns, such as query identifier, query
string, user, catalog, and others with information about the query processing.
JDBC connection URL to the database including credentials