1. Introduction
Redis SQL Trino is a Trino connector which allows access to RediSearch data from Trino.
This guide provides documentation and usage information across the following topics:
2. Installation
2.1. Trino
Trino installation instructions are available at https://trino.io/docs/current/installation.html.
2.2. RediSearch connector
Download latest release and unzip without any directory structure under:
<trino>/plugin/redisearch
Create a RediSearch connector configuration file and change/add properties as needed.
3. Configuration
To configure the RediSearch connector, create a catalog properties file and change/add properties as needed.
connector.name=redisearch
redisearch.uri=redis://localhost:6379
Property name | Description | Default |
---|---|---|
|
The schema that contains all tables defined without a qualifying schema name. |
|
|
Match index names case insensitively. |
|
|
Max number of documents returned by FT.SEARCH and FT.AGGREGATE when no limit is present in the SQL query. |
|
|
Number of rows read during each aggregation cursor fetch. |
|
Property name | Description | Default |
---|---|---|
|
A Redis connection string. Redis URI syntax. |
|
|
Redis connection username. |
|
|
Redis connection password. |
|
|
Connect to a Redis Cluster. |
|
|
Force Redis protocol version to RESP2. |
|
The RediSearch connector provides additional security options to support Redis servers with TLS mode.
Property name | Description | Default |
---|---|---|
|
Allow insecure connections (e.g. invalid certificates) when using SSL. |
|
|
X.509 CA certificate file to verify with. |
|
|
PKCS#8 private key file to authenticate with (PEM format). |
|
|
Password of the private key file, or null if it’s not password-protected. |
|
|
X.509 certificate chain file to authenticate with (PEM format). |
4. Clients
4.1. JDBC Driver
The Trino JDBC driver allows users to access Trino from Java-based applications, and other non-Java applications running in a JVM.
Refer to the Trino documentation for setup instructions.
The following is an example of a JDBC URL used to create a connection to Redis SQL Trino:
jdbc:trino://example.net:8080/redisearch/default
4.2. Tableau
Refer to the Tableau documentation for setup instructions.
4.3. Trino CLI
Refer to the Trino CLI documentation for setup instructions.
5. Build
Run these commands to build the Trino connector for RediSearch from source (requires Java 17+):
git clone https://github.com/redis-field-engineering/redis-sql-trino.git
cd Redis SQL Trino
./mvnw clean package -DskipTests
6. Complete Walkthrough
Follow these step-by-step instructions to deploy a single-node Trino server on Ubuntu.
6.1. Install Java
Trino requires a 64-bit version of Java 17. It is recommended to use Azul Zulu as the JDK.
$ java -version
openjdk version "17.0.4.1" 2022-08-12 LTS
OpenJDK Runtime Environment Zulu17.36+17-CA (build 17.0.4.1+1-LTS)
OpenJDK 64-Bit Server VM Zulu17.36+17-CA (build 17.0.4.1+1-LTS, mixed mode, sharing)
6.2. Set up Trino
Download the Trino server tarball and unpack it.
wget https://repo1.maven.org/maven2/io/trino/trino-server/403/trino-server-403.tar.gz
mkdir /usr/lib/trino
tar xzvf trino-server-403.tar.gz --directory /usr/lib/trino --strip-components 1
Trino needs a data directory for storing logs, etc. It is recommended to create a data directory outside of the installation directory, which allows it to be easily preserved when upgrading Trino.
mkdir -p /var/trino
Create an etc
directory inside the installation directory to hold configuration files.
mkdir /usr/lib/trino/etc
Create a node.properties
file.
node.environment=production
node.id=ffffffff-ffff-ffff-ffff-ffffffffffff
node.data-dir=/var/trino
Create a JVM config file.
-server
-Xmx16G
-XX:InitialRAMPercentage=80
-XX:MaxRAMPercentage=80
-XX:G1HeapRegionSize=32M
-XX:+ExplicitGCInvokesConcurrent
-XX:+ExitOnOutOfMemoryError
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-XX:ReservedCodeCacheSize=512M
-XX:PerMethodRecompilationCutoff=10000
-XX:PerBytecodeRecompilationCutoff=10000
-Djdk.attach.allowAttachSelf=true
-Djdk.nio.maxCachedBufferSize=2000000
-XX:+UnlockDiagnosticVMOptions
-XX:+UseAESCTRIntrinsics
Create a config properties file.
coordinator=true
node-scheduler.include-coordinator=true
http-server.http.port=8080
discovery.uri=http://localhost:8080
Create a logging configuration file.
io.trino=INFO
6.3. Set up Redis SQL Trino
Download latest release and unzip without any directory structure under plugin/redisearch
:
wget https://github.com/redis-field-engineering/redis-sql-trino/releases/download/v0.3.4/redis-sql-trino-0.3.4.zip
unzip -j redis-sql-trino-0.3.4.zip -d /usr/lib/trino/plugin/redisearch
Create a etc/catalog subdirectory:
mkdir /usr/lib/trino/etc/catalog
Create a RediSearch connector configuration file:
connector.name=redisearch
redisearch.uri=redis://localhost:6379
Change and/or add properties as needed.
6.5. Run Trino CLI
Download and run trino-cli-403-executable.jar:
wget https://repo1.maven.org/maven2/io/trino/trino-cli/403/trino-cli-403-executable.jar -O /usr/local/bin/trino
chmod +x /usr/local/bin/trino
trino --catalog redisearch --schema default
Run a SQL query:
trino:default> select * from mySearchIndex;