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

[ADH-5210]: Create docke-compose for running trino cluster in containers #2

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
4 changes: 4 additions & 0 deletions core/docker/arenadata/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
TRINO_VERSION=455-SNAPSHOT-amd64
POSTGRES_DB=trino
POSTGRES_USER=trino
POSTGRES_PASSWORD=trino
35 changes: 35 additions & 0 deletions core/docker/arenadata/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Trino server in multi node configuration in docker containers

## Build the project

```bash
cd ../../../
mvn clean install -DskipTests=true
```

## Build the docker image with a specific architecture

```bash
../build.sh -a amd64
```

## Start docker containers

```bash
docker compose --env-file .env up -d
```

## Stop docker containers

```bash
docker compose down -v
```

## Connect to server via trino-cli

* go to directory `../../../client/trino-cli/target`
* to start the cli in interactive mode, execute command:

```bash
./trino-cli-${TRINO_VERSION}-executable.jar http://localhost:8080
```
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
connector.name=jmx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
connector.name=memory
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
connector.name=postgresql
connection-url=jdbc:postgresql://postgres-db:5432/postgres
connection-user=trino
connection-password=trino
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
connector.name=tpcds
tpcds.splits-per-node=4
2 changes: 2 additions & 0 deletions core/docker/arenadata/coordinator/etc/catalog/tpch.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
connector.name=tpch
tpch.splits-per-node=4
9 changes: 9 additions & 0 deletions core/docker/arenadata/coordinator/etc/config.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
coordinator=true
node-scheduler.include-coordinator=true
http-server.http.port=8080
discovery.uri=http://coordinator:8080
catalog.management=ARENADATA

arenadata.catalog.store.jdbc.url=jdbc:postgresql://postgres-db:5432/trino
arenadata.catalog.store.jdbc.username=trino
arenadata.catalog.store.jdbc.password=trino
16 changes: 16 additions & 0 deletions core/docker/arenadata/coordinator/etc/jvm.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
-server
-agentpath:/usr/lib/trino/bin/libjvmkill.so
-XX:InitialRAMPercentage=80
-XX:MaxRAMPercentage=80
-XX:G1HeapRegionSize=32M
-XX:+ExplicitGCInvokesConcurrent
-XX:+HeapDumpOnOutOfMemoryError
-XX:+ExitOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-XX:ReservedCodeCacheSize=256M
-XX:PerMethodRecompilationCutoff=10000
-XX:PerBytecodeRecompilationCutoff=10000
-Djdk.attach.allowAttachSelf=true
-Djdk.nio.maxCachedBufferSize=2000000
# Allow loading dynamic agent used by JOL
-XX:+EnableDynamicAgentLoading
2 changes: 2 additions & 0 deletions core/docker/arenadata/coordinator/etc/log.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Enable verbose logging from Trino
#io.trino=DEBUG
2 changes: 2 additions & 0 deletions core/docker/arenadata/coordinator/etc/node.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node.environment=docker
node.data-dir=/data/trino
49 changes: 49 additions & 0 deletions core/docker/arenadata/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
version: "3.8"
services:
postgres:
image: "docker.io/library/postgres:12.0"
restart: unless-stopped
container_name: postgres-db
hostname: postgres-db
environment:
POSTGRES_DB: '${POSTGRES_DB}'
POSTGRES_USER: '${POSTGRES_USER}'
POSTGRES_PASSWORD: '${POSTGRES_PASSWORD}'
ports:
- '5432:5432'
healthcheck:
test: psql -d ${POSTGRES_DB} -U ${POSTGRES_USER} -Atc 'SELECT 1;'
interval: 30s
timeout: 15s
retries: 3

coordinator:
image: "trino:${TRINO_VERSION}"
ports:
- "8080:8080"
container_name: "coordinator"
volumes:
- ./coordinator/etc:/etc/trino:rw
depends_on:
- postgres

worker0:
image: "trino:${TRINO_VERSION}"
container_name: "worker0"
ports:
- "8081:8080"
volumes:
- ./worker/etc:/etc/trino:rw
depends_on:
- postgres

worker1:
image: "trino:${TRINO_VERSION}"
container_name: "worker1"
ports:
- "8082:8080"
volumes:
- ./worker/etc:/etc/trino:rw
depends_on:
- postgres

1 change: 1 addition & 0 deletions core/docker/arenadata/worker/etc/catalog/jmx.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
connector.name=jmx
1 change: 1 addition & 0 deletions core/docker/arenadata/worker/etc/catalog/memory.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
connector.name=memory
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
connector.name=postgresql
connection-url=jdbc:postgresql://postgres-db:5432/postgres
connection-user=trino
connection-password=trino
2 changes: 2 additions & 0 deletions core/docker/arenadata/worker/etc/catalog/tpcds.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
connector.name=tpcds
tpcds.splits-per-node=4
2 changes: 2 additions & 0 deletions core/docker/arenadata/worker/etc/catalog/tpch.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
connector.name=tpch
tpch.splits-per-node=4
9 changes: 9 additions & 0 deletions core/docker/arenadata/worker/etc/config.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#single node install config
coordinator=false
http-server.http.port=8080
discovery.uri=http://coordinator:8080
catalog.management=ARENADATA

arenadata.catalog.store.jdbc.url=jdbc:postgresql://postgres-db:5432/trino
arenadata.catalog.store.jdbc.username=trino
arenadata.catalog.store.jdbc.password=trino
16 changes: 16 additions & 0 deletions core/docker/arenadata/worker/etc/jvm.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
-server
-agentpath:/usr/lib/trino/bin/libjvmkill.so
-XX:InitialRAMPercentage=80
-XX:MaxRAMPercentage=80
-XX:G1HeapRegionSize=32M
-XX:+ExplicitGCInvokesConcurrent
-XX:+HeapDumpOnOutOfMemoryError
-XX:+ExitOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-XX:ReservedCodeCacheSize=256M
-XX:PerMethodRecompilationCutoff=10000
-XX:PerBytecodeRecompilationCutoff=10000
-Djdk.attach.allowAttachSelf=true
-Djdk.nio.maxCachedBufferSize=2000000
# Allow loading dynamic agent used by JOL
-XX:+EnableDynamicAgentLoading
2 changes: 2 additions & 0 deletions core/docker/arenadata/worker/etc/log.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Enable verbose logging from Trino
#io.trino=DEBUG
2 changes: 2 additions & 0 deletions core/docker/arenadata/worker/etc/node.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node.environment=docker
node.data-dir=/data/trino
1 change: 0 additions & 1 deletion core/docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ for arch in "${ARCHITECTURES[@]}"; do
echo "🫙 Building the image for $arch with JDK ${JDK_RELEASE}"
docker build \
"${WORK_DIR}" \
--progress=plain \
--pull \
--build-arg JDK_VERSION="${JDK_RELEASE}" \
--build-arg JDK_DOWNLOAD_LINK="$(jdk_download_link "${JDKS_PATH}/${JDK_RELEASE}" "${arch}")" \
Expand Down
6 changes: 6 additions & 0 deletions core/trino-main/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@
<artifactId>discovery-server</artifactId>
</dependency>

<dependency>
<groupId>io.arenadata</groupId>
<artifactId>trino-catalog-manager</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class CatalogManagerConfig
{
public enum CatalogMangerKind
{
STATIC, DYNAMIC
STATIC, DYNAMIC, ARENADATA
}

private CatalogMangerKind catalogMangerKind = CatalogMangerKind.STATIC;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.google.inject.Binder;
import com.google.inject.Scopes;
import io.airlift.configuration.AbstractConfigurationAwareModule;
import io.arenadata.trino.catalog.ArenadataCatalogManagerModule;

import static com.google.inject.multibindings.OptionalBinder.newOptionalBinder;

Expand All @@ -34,6 +35,7 @@ protected void setup(Binder binder)
switch (config.getCatalogMangerKind()) {
case STATIC -> install(new StaticCatalogManagerModule());
case DYNAMIC -> install(new DynamicCatalogManagerModule());
case ARENADATA -> install(new ArenadataCatalogManagerModule());
}

install(new CatalogServiceProviderModule());
Expand Down
Loading
Loading