Apache Gravitino Trino connector installation
To install the Apache Gravitino Trino connector, you should first deploy the Trino environment, and then install the Gravitino Trino connector plugin into Trino. Please refer to the Deploying Trino documentation and do the following steps:
The examples in this document use Trino 469 by default.
Get the connector package
Gravitino provides different Trino connector packages for different Trino version segments. You need to choose the package by your Trino server version first.
| Trino server version | Connector package segment |
|---|---|
| 435-439 | trino-connector-435-439 |
| 440-445 | trino-connector-440-445 |
| 446-451 | trino-connector-446-451 |
| 452-468 | trino-connector-452-468 |
| 469-472 | trino-connector-469-472 |
| 473-478 | trino-connector-473-478 |
For Trino 469, choose the trino-connector-469-472 package.
The release package naming format is:
gravitino-trino-connector-<segment>-<version>.tar.gz
For example:
gravitino-trino-connector-469-472-<version>.tar.gz
You can get the package in the following ways:
- Download a released package from GitHub Releases. For Trino
469, download the469-472package:
cd /tmp
wget https://github.com/apache/gravitino/releases/download/<version>/gravitino-trino-connector-469-472-<version>.tar.gz
tar -zxvf gravitino-trino-connector-469-472-<version>.tar.gz
- Build from source in the Gravitino project. For Trino
469, build moduletrino-connector-469-472:
cd <gravitino-source-root>
./gradlew :trino-connector:trino-connector-469-472:assembleTrinoConnector
cd distribution
tar -zxvf gravitino-trino-connector-469-472-<version>.tar.gz
After unpacking, you can see the connector directory:
gravitino-trino-connector-469-472-<version>
Install the connector package
- Download and unpack the correct Gravitino Trino connector tarball for your Trino version.
- Rename the unpacked connector directory to
gravitino, and then copy it to the Trino plugin directory. Normally, the directory location isTrino-server-<version>/plugin, and the directory contains other catalogs used by Trino. - Add Trino JVM arguments
-Dlog4j.configurationFile=file:////etc/trino/log4j2.propertiesto enable logging for the Gravitino Trino connector. - Update Trino coordinator configuration.
You need to set
catalog.management=dynamic, The config location isTrino-server-<version>/etc/config.properties, and the contents like:
coordinator=true
node-scheduler.include-coordinator=true
http-server.http.port=8080
catalog.management=dynamic
discovery.uri=http://0.0.0.0:8080
Example
You can install the Gravitino Trino connector in Trino office docker images step by step.
Running the container
Use the docker command to create a container from the trinodb/trino image. Assign it the trino-gravitino name.
Run it in the background, and map the default Trino port, which is 8080, from inside the container to port 8080 on your machine.
docker run --name trino-gravitino -d -p 8080:8080 trinodb/trino:469
Run docker ps to check whether the container is running.
Installing the Apache Gravitino Trino connector
Download the Gravitino Trino connector tarball for Trino 469 and unpack it.
cd /tmp
wget https://github.com/apache/gravitino/releases/download/<version>/gravitino-trino-connector-469-472-<version>.tar.gz
tar -zxvf gravitino-trino-connector-469-472-<version>.tar.gz
You can see the connector directory gravitino-trino-connector-469-472-<version> after unpacking.
Rename the connector directory to gravitino, then copy it to the Trino container's plugin directory.
mv /tmp/gravitino-trino-connector-469-472-<version> /tmp/gravitino
docker cp /tmp/gravitino trino-gravitino:/lib/trino/plugin
Check the plugin directory in the container.
docker exec -it trino-gravitino /bin/bash
cd /lib/trino/plugin
Now you can see the Gravitino Trino connector directory in the plugin directory.
Configuring the Trino
You can find the Trino configuration file config.properties in the directory /etc/trino. You need changed the file like this:
#single node install config
coordinator=true
node-scheduler.include-coordinator=true
http-server.http.port=8080
discovery.uri=http://localhost:8080
catalog.management=dynamic
Configuring the Apache Gravitino Trino connector
Assuming you have now started the Gravitino server on the host gravitino-server-host and already created a metalake named test, if those have not been prepared, please refer to the Gravitino getting started.
To configure Gravitino Trino connector correctly, you need to put the following configurations to the Trino configuration file /etc/trino/catalog/gravitino.properties.
connector.name=gravitino
gravitino.uri=http://gravitino-server-host:8090
gravitino.metalake=test
- The
gravitino.namedefines which Gravitino Trino connector is used. It must begravitino. - The
gravitino.metalakedefines which metalake are used. It should exist in the Gravitino server. - The
gravitino.uridefines the connection information about Gravitino server. Make sure your container can access the Gravitino server.
Full configurations for Apache Gravitino Trino connector can be seen here
If you haven't created the metalake named test, you can use the following command to create it.
curl -X POST -H "Content-Type: application/json" -d '{"name":"test","comment":"comment","properties":{}}' http://gravitino-server-host:8090/api/metalakes
And then restart the Trino container to load the Gravitino Trino connector.
docker restart trino-gravitino
Verifying the Apache Gravitino Trino connector
Use the Trino CLI to connect to the Trino container and run a query.
docker exec -it trino-gravitino trino
trino> SHOW CATALOGS;
Catalog
------------------------
gravitino
jmx
memory
tpcds
tpch
system
You can see the gravitino catalog in the result set. This signifies the successful installation of the Gravitino Trino connector.
Assuming you have created a catalog named test.jdbc-mysql in the Gravitino server, or please refer to Create a Catalog. Then you can use the Trino CLI to connect to the Trino container and run a query like this.
docker exec -it trino-gravitino trino
trino> SHOW CATALOGS;
Catalog
------------------------
gravitino
jmx
memory
tpcds
tpch
system
jdbc-mysql
The catalog named 'jdbc-mysql' is the catalog that you created by gravitino server, and you can use it to access the mysql database like other Trino catalogs.