Last active
October 16, 2024 12:45
-
-
Save posulliv/6c6550b8e51a5f1715bfbd9a01841d97 to your computer and use it in GitHub Desktop.
Simple demo of Trino HA using Nginx reverse proxy.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.3' | |
services: | |
trino_a: | |
image: trinodb/trino | |
container_name: trino_a | |
ports: | |
- 8080:8080 | |
volumes: | |
- ./trino_a.config.properties:/etc/trino/config.properties | |
- ./jvm.config:/etc/trino/jvm.config | |
trino_b: | |
image: trinodb/trino | |
container_name: trino_b | |
ports: | |
- 8081:8081 | |
volumes: | |
- ./trino_b.config.properties:/etc/trino/config.properties | |
- ./jvm.config:/etc/trino/jvm.config | |
trino_worker: | |
image: trinodb/trino | |
container_name: trino_worker | |
volumes: | |
- ./trino_worker.config.properties:/etc/trino/config.properties | |
- ./jvm.config:/etc/trino/jvm.config | |
nginx: | |
image: nginx | |
container_name: nginx | |
ports: | |
- 80:80 | |
volumes: | |
- ./nginx.conf:/etc/nginx/conf.d/default.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-server | |
-Xmx2G | |
-XX:+UseG1GC | |
-XX:+UseGCOverheadLimit | |
-XX:+ExplicitGCInvokesConcurrent | |
-XX:+HeapDumpOnOutOfMemoryError | |
-XX:+ExitOnOutOfMemoryError | |
-XX:ReservedCodeCacheSize=150M | |
-Duser.timezone=UTC | |
-Djdk.attach.allowAttachSelf=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream trino { | |
server trino_a:8080 fail_timeout=3s max_fails=1; | |
server trino_b:8081 backup; | |
} | |
server { | |
listen 80; | |
server_name localhost; | |
location / { | |
proxy_pass http://trino; | |
proxy_redirect http://trino/ /; | |
proxy_connect_timeout 3; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
coordinator=true | |
node-scheduler.include-coordinator=true | |
http-server.http.port=8080 | |
query.max-memory=1.4GB | |
query.max-memory-per-node=1.4GB | |
query.max-total-memory-per-node=1.4GB | |
discovery.uri=http://localhost:8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
coordinator=true | |
node-scheduler.include-coordinator=true | |
http-server.http.port=8081 | |
query.max-memory=1.4GB | |
query.max-memory-per-node=1.4GB | |
query.max-total-memory-per-node=1.4GB | |
discovery.uri=http://localhost:8081 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
coordinator=false | |
query.max-memory=1.4GB | |
query.max-memory-per-node=1.4GB | |
query.max-total-memory-per-node=1.4GB | |
discovery.uri=http://nginx:80 |
Is it possible to try to the above on multi host using windows docker desktop? I have been trying to set it up but Im unable to get the worker to establish connection with the coordinator . I keep getting the following error:
ERROR Announcer-0 io.airlift.discovery.client.Announcer Cannot connect to discovery server for announce
2024-10-16 07:43:07 io.airlift.discovery.client.DiscoveryException: Announcement failed with status code 406:
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If expose nginx with ports (not 80 443), should use
proxy_set_header Host $http_host;
to make trinodb build correct urls in response.$http_host
includes port and$host
not includes port.My Nginx config: