Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add doc to setup trino+redis in docker #228

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions docs/dockerized_trino_setup_redis_valkey/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: '3.8'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Заведи, пожалуйста, папку "redis" по пути https://github.com/ydb-platform/fq-connector-go/tree/main/app/server/datasource и сложи всё эти файлы туда. Так мне будет легче найти, если что. И там будет всё твоё хозяйство.

Также, на будущее, понадобится добавить эти файлы частично или полностью в окружение для интеграционных тестов. Там docker-compose файл общий: https://github.com/ydb-platform/fq-connector-go/blob/main/tests/infra/datasource/docker-compose.yaml


services:
trino:
image: trinodb/trino:latest
container_name: trino
ports:
- "8080:8080"
volumes:
- ./etc:/etc/trino
- ./data:/var/trino/data
depends_on:
- valkey

valkey:
image: valkey/valkey:8.0.1
container_name: valkey
ports:
- "6379:6379"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
connector.name=redis
redis.table-names=example_table
redis.nodes=valkey:6379
redis.default-schema=default
redis.table-description-dir=/etc/trino/table-descriptions
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
coordinator=true
node-scheduler.include-coordinator=true
http-server.http.port=8080
discovery.uri=http://localhost:8080
17 changes: 17 additions & 0 deletions docs/dockerized_trino_setup_redis_valkey/etc/jvm.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-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
-Dfile.encoding=UTF-8
# Allow loading dynamic agent used by JOL
-XX:+EnableDynamicAgentLoading
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
io.trino=INFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node.environment=production
node.id=ffffffff-ffff-ffff-ffff-ffffffffffff
node.data-dir=/var/trino/data
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"tableName": "example_table",
"schemaName": "default",
"key": {
"dataFormat": "raw",
"fields": [
{
"name": "id",
"type": "varchar"
}
]
},
"value": {
"dataFormat": "hash",
"fields": [
{
"name": "field1",
"type": "varchar",
"mapping": "field1"
},
{
"name": "field2",
"type": "varchar",
"mapping": "field2"
},
{
"name": "field3",
"type": "varchar",
"mapping": "field3"
}
]
}
}
81 changes: 81 additions & 0 deletions docs/dockerized_trino_setup_redis_valkey/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Docker compose setup for Trino + Redis/Valkey

## Official Docs:
- [Trino](https://trino.io/docs/current/connector/redis.html)
- [Valkey (open-source Redis)](https://valkey.io/download/)

## Project Structure

```
./
├──── data/
│ └── ... # empty folder for redis usage
├──── etc/
│ └── catalog/
│ └── redis.properties
│ └── table-descriptions/
│ └── example-table.json
│ └── config.properties
│ └── log.properties
│ └── node.properties
│ └── jvm.config
├── docker-compose.yml
└── readme.md
```

## Instructions

### Steps to Run

1. Pull containers:

```sh
docker pull trinodb/trino
docker pull valkey/valkey
```

2. Start the services:

```sh
docker-compose up -d
```

### Example Usage

1. Connect to Valkey:

```sh
docker exec -it valkey redis-cli
```

2. Insert some data:

```r
HSET example_table:1 field1 "Alice" field2 "Wonderland" field3 "25";
```

3. Connect to Trino:

```sh
docker exec -it trino trino
```

4. Run a sample query:

```sql
SELECT * FROM redis.default.example_table;
```

You should see this:

```
id | field1 | field2 | field3
-----------------+--------+-------------+--------
example_table:2 | Bob | Builderland | 30
example_table:1 | Alice | Wonderland | 25
(2 rows)

Query 20250105_174102_00000_nf6v2, FINISHED, 1 node
Splits: 1 total, 1 done (100.00%)
0.40 [2 rows, 0B] [5 rows/s, 0B/s]
```
Loading