|
1 | 1 | = Redis SQL |
2 | 2 | :linkattrs: |
3 | | -:project-owner: redis-field-engineering |
4 | | -:project-name: redis-sql |
5 | | -:project-group: com.redis |
6 | | -:project-version: 0.2.5 |
7 | | -:project-url: https://github.com/{project-owner}/{project-name} |
8 | | -:artifact-id: trino-redisearch |
9 | | -:trino-dir: /usr/lib/trino |
10 | | -:trino-datadir: /var/trino |
11 | | -:trino-version: 395 |
| 3 | +:project-owner: redis-field-engineering |
| 4 | +:project-name: redis-sql |
| 5 | +:project-group: com.redis |
| 6 | +:project-version: 0.2.5 |
| 7 | +:project-url: https://github.com/{project-owner}/{project-name} |
| 8 | +:documentation-url: https://{project-owner}.github.io/{project-name} |
| 9 | +:artifact-id: trino-redisearch |
| 10 | +:trino-dir: /usr/lib/trino |
| 11 | +:trino-datadir: /var/trino |
| 12 | +:trino-version: 395 |
| 13 | + |
12 | 14 |
|
13 | 15 | image:{project-url}/actions/workflows/early-access.yml/badge.svg["Build Status", link="{project-url}/actions/workflows/early-access.yml"] |
14 | 16 | image:https://codecov.io/gh/{project-owner}/{project-name}/branch/master/graph/badge.svg?token={codecov-token}["Coverage", link="https://codecov.io/gh/{project-owner}/{project-name}"] |
15 | 17 |
|
16 | 18 | Redis SQL is a https://trino.io[Trino] connector which allows access to RediSearch data from Trino. |
17 | | -This document describes how to set up the RediSearch Connector to run SQL queries against RediSearch. |
18 | | - |
19 | | -image::https://asciinema.org/a/526185.svg[asciicast,link=https://asciinema.org/a/526185] |
20 | 19 |
|
21 | 20 | NOTE: RediSearch 2.0 or later is required. |
22 | 21 |
|
23 | | -== Configuration |
24 | | -To configure the RediSearch connector, create a catalog properties file `etc/catalog/redisearch.properties` with the following contents, replacing the properties as appropriate: |
25 | | - |
26 | | -[source,properties] |
27 | | ----- |
28 | | -connector.name=redisearch |
29 | | -redisearch.uri=redis://localhost:6379 |
30 | | -redisearch.default-schema-name=default |
31 | | ----- |
32 | | - |
33 | | -[[properties]] |
34 | | -=== Configuration properties |
35 | | - |
36 | | -[cols="1,1,1"] |
37 | | -|=== |
38 | | -|Property name |Description |Default |
39 | | - |
40 | | -|`redisearch.uri` |
41 | | -|A Redis connection string. https://github.com/lettuce-io/lettuce-core/wiki/Redis-URI-and-connection-details#uri-syntax[Redis URI syntax]. |
42 | | -| |
43 | | - |
44 | | -|`redisearch.default-schema-name` |
45 | | -|The schema that contains all tables defined without a qualifying schema name. |
46 | | -|`default` |
47 | | - |
48 | | -|`redisearch.username` |
49 | | -|Redis connection username. |
50 | | -| |
51 | | - |
52 | | -|`redisearch.password` |
53 | | -|Redis connection password. |
54 | | -| |
55 | | - |
56 | | -|`redisearch.cluster` |
57 | | -|Connect to a Redis Cluster. |
58 | | -|`false` |
| 22 | +== Documentation |
59 | 23 |
|
60 | | -|`redisearch.case-insensitive-names` |
61 | | -|Match index names case insensitively. |
62 | | -|`false` |
| 24 | +Documentation is available at link:{documentation-url}[{documentation-url}]. |
63 | 25 |
|
64 | | -|`redisearch.default-limit` |
65 | | -|Max number of documents returned by FT.SEARCH and FT.AGGREGATE when no limit is present in the SQL query. |
66 | | -|`10000` |
67 | | - |
68 | | -|`redisearch.cursor-count` |
69 | | -|Number of rows read during each https://redis.io/docs/stack/search/reference/aggregations/#cursor-api[aggregation cursor] fetch. |
70 | | -|`1000` |
71 | | -|=== |
72 | | - |
73 | | -== TLS security |
74 | | -The RediSearch connector provides additional security options to support Redis servers with TLS mode. |
75 | | - |
76 | | -The allowed configuration values are: |
77 | | - |
78 | | -[cols="1,1"] |
79 | | -|=== |
80 | | -|Property name |Description |
81 | | - |
82 | | -|`redisearch.insecure` |
83 | | -|Allow insecure connections (e.g. invalid certificates) when using SSL. |
84 | | - |
85 | | -|`redisearch.cacert-path` |
86 | | -|X.509 CA certificate file to verify with. |
87 | | - |
88 | | -|`redisearch.key-path` |
89 | | -|PKCS#8 private key file to authenticate with (PEM format). |
90 | | - |
91 | | -|`redisearch.key-password` |
92 | | -|Password of the private key file, or null if it's not password-protected. |
93 | | - |
94 | | -|`redisearch.cert-path` |
95 | | -|X.509 certificate chain file to authenticate with (PEM format). |
96 | | -|=== |
| 26 | +== Support |
97 | 27 |
|
| 28 | +Contact us on the https://forum.redis.com/[Redis Forum] or create an issue on {project-url}/issues[Github] where we provide support on a good faith effort basis. |
98 | 29 |
|
99 | 30 | == Docker Example |
100 | 31 |
|
| 32 | +image::https://asciinema.org/a/526185.svg[asciicast,link=https://asciinema.org/a/526185] |
| 33 | + |
101 | 34 | .Clone the project |
102 | 35 | [source,console,subs="verbatim,attributes"] |
103 | 36 | ---- |
@@ -134,164 +67,3 @@ docker exec -it trino trino --catalog redisearch --schema default |
134 | 67 | ---- |
135 | 68 | trino:default> select * from beers; |
136 | 69 | ---- |
137 | | - |
138 | | -== Tableau |
139 | | - |
140 | | -Follow these steps to connect Tableau: https://help.tableau.com/current/pro/desktop/en-us/examples_presto.htm |
141 | | - |
142 | | -== Install and Run |
143 | | - |
144 | | -=== Trino |
145 | | - |
146 | | -Trino installation instructions are available here: https://trino.io/docs/current/installation.html |
147 | | - |
148 | | -The following steps deploy a single-node Trino server on Ubuntu. |
149 | | - |
150 | | -Trino requires a 64-bit of Java 17. |
151 | | -It is recommended to https://www.azul.com/downloads/?package=jdk[Azul Zulu] as the JDK. |
152 | | -[source,console] |
153 | | ----- |
154 | | -$ java -version |
155 | | -openjdk version "17.0.4.1" 2022-08-12 LTS |
156 | | -OpenJDK Runtime Environment Zulu17.36+17-CA (build 17.0.4.1+1-LTS) |
157 | | -OpenJDK 64-Bit Server VM Zulu17.36+17-CA (build 17.0.4.1+1-LTS, mixed mode, sharing) |
158 | | ----- |
159 | | - |
160 | | -Download the Trino server tarball and unpack it. |
161 | | -[source,console,subs="verbatim,attributes"] |
162 | | ----- |
163 | | -wget https://repo1.maven.org/maven2/io/trino/trino-server/{trino-version}/trino-server-{trino-version}.tar.gz |
164 | | -mkdir {trino-dir} |
165 | | -tar xzvf trino-server-{trino-version}.tar.gz --directory {trino-dir} --strip-components 1 |
166 | | ----- |
167 | | - |
168 | | -Trino needs a data directory for storing logs, etc. |
169 | | -It is recommended to create a data directory outside of the installation directory, which allows it to be easily preserved when upgrading Trino. |
170 | | -[source,console,subs="verbatim,attributes"] |
171 | | ----- |
172 | | -mkdir -p {trino-datadir} |
173 | | ----- |
174 | | - |
175 | | -Create an `etc` directory inside the installation directory to hold configuration files. |
176 | | -[source,console,subs="verbatim,attributes"] |
177 | | ----- |
178 | | -mkdir {trino-dir}/etc |
179 | | ----- |
180 | | - |
181 | | -Create a node properties file `etc/node.properties`. |
182 | | - |
183 | | -.{trino-dir}/etc/node.properties |
184 | | -[source,properties,subs="verbatim,attributes"] |
185 | | ----- |
186 | | -node.environment=production |
187 | | -node.id=ffffffff-ffff-ffff-ffff-ffffffffffff |
188 | | -node.data-dir={trino-datadir} |
189 | | ----- |
190 | | - |
191 | | -Create a JVM config file `etc/jvm.config`. |
192 | | - |
193 | | -.{trino-dir}/etc/jvm.config |
194 | | -[source,properties] |
195 | | ----- |
196 | | --server |
197 | | --Xmx16G |
198 | | --XX:InitialRAMPercentage=80 |
199 | | --XX:MaxRAMPercentage=80 |
200 | | --XX:G1HeapRegionSize=32M |
201 | | --XX:+ExplicitGCInvokesConcurrent |
202 | | --XX:+ExitOnOutOfMemoryError |
203 | | --XX:+HeapDumpOnOutOfMemoryError |
204 | | --XX:-OmitStackTraceInFastThrow |
205 | | --XX:ReservedCodeCacheSize=512M |
206 | | --XX:PerMethodRecompilationCutoff=10000 |
207 | | --XX:PerBytecodeRecompilationCutoff=10000 |
208 | | --Djdk.attach.allowAttachSelf=true |
209 | | --Djdk.nio.maxCachedBufferSize=2000000 |
210 | | --XX:+UnlockDiagnosticVMOptions |
211 | | --XX:+UseAESCTRIntrinsics |
212 | | ----- |
213 | | - |
214 | | -Create a config properties file `etc/config.properties`. |
215 | | -.{trino-dir}/etc/config.properties |
216 | | -[source,properties] |
217 | | ----- |
218 | | -coordinator=true |
219 | | -node-scheduler.include-coordinator=true |
220 | | -http-server.http.port=8080 |
221 | | -discovery.uri=http://localhost:8080 |
222 | | ----- |
223 | | - |
224 | | -Create a log levels file `etc/log.properties`. |
225 | | -.{trino-dir}/etc/log.properties |
226 | | -[source,properties] |
227 | | ----- |
228 | | -io.trino=INFO |
229 | | ----- |
230 | | - |
231 | | -=== Redis SQL |
232 | | - |
233 | | -Download latest {project-url}/releases/latest[release] and unzip without any directory structure under `<trino>/plugin/redisearch`. |
234 | | - |
235 | | -[source,console,subs="verbatim,attributes"] |
236 | | ----- |
237 | | -wget {project-url}/releases/download/v{trino-version}/{artifact-id}-{trino-version}.zip |
238 | | -unzip -j {artifact-id}-{project-version}.zip -d {trino-dir}/plugin/redisearch |
239 | | ----- |
240 | | - |
241 | | -Create a `redisearch.properties` file under `{trino-dir}/etc/catalog` directory: |
242 | | - |
243 | | -[source,properties] |
244 | | ----- |
245 | | -connector.name=redisearch |
246 | | -redisearch.uri=redis://localhost:6379 |
247 | | ----- |
248 | | - |
249 | | -Change and/or add <<properties,properties>> as needed. |
250 | | - |
251 | | -=== Run |
252 | | - |
253 | | -==== Trino Server |
254 | | - |
255 | | -Start the Trino server by running: |
256 | | - |
257 | | -[source,console,subs="verbatim,attributes"] |
258 | | ----- |
259 | | -{trino-dir}/bin/launcher run |
260 | | ----- |
261 | | - |
262 | | -==== Trino CLI |
263 | | - |
264 | | -Download https://repo1.maven.org/maven2/io/trino/trino-cli/{trino-version}/trino-cli-{trino-version}-executable.jar[trino-cli-{trino-version}-executable.jar], rename it to `trino`, make it executable with `chmod +x`, and run it to show the version of the CLI: |
265 | | - |
266 | | -[source,console,subs="verbatim,attributes"] |
267 | | ----- |
268 | | -wget https://repo1.maven.org/maven2/io/trino/trino-cli/{trino-version}/trino-cli-{trino-version}-executable.jar |
269 | | -mv trino-cli-{trino-version}-executable.jar trino |
270 | | -chmod +x trino |
271 | | ----- |
272 | | - |
273 | | -Connect to Trino using the CLI: |
274 | | - |
275 | | -[source,console] |
276 | | ----- |
277 | | -./trino --catalog redisearch --schema default |
278 | | ----- |
279 | | - |
280 | | -Run a SQL query: |
281 | | - |
282 | | -[source,console] |
283 | | ----- |
284 | | -trino:default> select * from mySearchIndex; |
285 | | ----- |
286 | | - |
287 | | -== Build |
288 | | - |
289 | | -Run these commands to build the Trino connector for RediSearch from source (requires Java 17+): |
290 | | - |
291 | | -[source,console,subs="verbatim,attributes"] |
292 | | ----- |
293 | | -git clone {project-url}.git |
294 | | -cd {project-name} |
295 | | -./gradlew clean build |
296 | | ----- |
297 | | - |
0 commit comments