-
Notifications
You must be signed in to change notification settings - Fork 490
Trino getting started docker compose #42
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
Merged
Merged
Changes from 13 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
7b6081a
setting up trino docker, first pass
kevinjqliu 2b6715b
mkdir
kevinjqliu 919b390
use use principal token
kevinjqliu 2224c11
rename
kevinjqliu 9a03f80
add copyright to all new files
kevinjqliu c741721
use ASF license
kevinjqliu 1d5161a
newline
kevinjqliu 081cc85
use trino docker image default config
kevinjqliu 98fb083
move to trino/ subdir
kevinjqliu 2af27cd
rename to create-polaris-catalog.sh
kevinjqliu feb24e0
fix docker build
kevinjqliu 9c2be7f
recopy over polaris docker-compose
kevinjqliu ca27297
add README
kevinjqliu b3e18d6
context: ../../
kevinjqliu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| <!-- | ||
| Licensed to the Apache Software Foundation (ASF) under one | ||
| or more contributor license agreements. See the NOTICE file | ||
| distributed with this work for additional information | ||
| regarding copyright ownership. The ASF licenses this file | ||
| to you under the Apache License, Version 2.0 (the | ||
| "License"); you may not use this file except in compliance | ||
| with the License. You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, | ||
| software distributed under the License is distributed on an | ||
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| KIND, either express or implied. See the License for the | ||
| specific language governing permissions and limitations | ||
| under the License. | ||
| --> | ||
|
|
||
| # Getting Started with Trino and Apache Polaris | ||
|
|
||
| This getting started guide provides a docker-compose file to set up [Trino](https://trino.io/) with Apache Polaris. Apache Polaris is configured as an Iceberg REST Catalog in Trino. | ||
|
|
||
| ## Run the docker-compose file | ||
| To start the docker-compose file, run this command from the repo's root directory: | ||
| ``` | ||
| docker-compose -f getting-started/trino/docker-compose-trino.yml up | ||
| ``` | ||
|
|
||
| ## Run Trino queries via Trino ClI | ||
| To access the Trino CLI, run this command | ||
| ``` | ||
| docker exec -it trino-trino-1 trino | ||
| ``` | ||
| Note, `trino-trino-1` is the name docker container. | ||
|
|
||
| Example Trino queries: | ||
| ``` | ||
| SHOW CATALOGS; | ||
| SHOW SCHEMAS FROM iceberg; | ||
| SHOW TABLES FROM iceberg.information_schema; | ||
| DESCRIBE iceberg.information_schema.tables; | ||
|
|
||
| CREATE SCHEMA iceberg.tpch; | ||
| CREATE TABLE iceberg.tpch.test_polaris AS SELECT 1 x; | ||
| SELECT * FROM iceberg.tpch.test_polaris; | ||
| ``` | ||
|
|
||
| ## Note | ||
| The polaris catalog setup script use the credential `principal:root;realm:default-realm`. This credential is used so users do not need to fetch credentials from Apache Polaris' console output. | ||
|
|
||
| An example catalog is created in Apache Polaris using the `curl` command. See `create-polaris-catalog.sh` for details. |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
| # | ||
|
|
||
| PRINCIPAL_TOKEN="principal:root;realm:default-realm" | ||
|
|
||
| # Use local filesystem by default | ||
| curl -i -X POST -H "Authorization: Bearer $PRINCIPAL_TOKEN" -H 'Accept: application/json' -H 'Content-Type: application/json' \ | ||
| http://polaris:8181/api/management/v1/catalogs \ | ||
| -d '{ | ||
| "catalog": { | ||
| "name": "polaris", | ||
| "type": "INTERNAL", | ||
| "readOnly": false, | ||
| "properties": { | ||
| "default-base-location": "file:///tmp/polaris/" | ||
| }, | ||
| "storageConfigInfo": { | ||
| "storageType": "FILE", | ||
| "allowedLocations": [ | ||
| "file:///tmp" | ||
| ] | ||
| } | ||
| } | ||
| }' |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
| # | ||
|
|
||
| services: | ||
| polaris: | ||
| build: | ||
| context: . | ||
| ports: | ||
| - "8181:8181" | ||
| - "8182" | ||
| environment: | ||
| AWS_REGION: us-west-2 | ||
| GOOGLE_APPLICATION_CREDENTIALS: $GOOGLE_APPLICATION_CREDENTIALS | ||
| AZURE_TENANT_ID: $AZURE_TENANT_ID | ||
| AZURE_CLIENT_ID: $AZURE_CLIENT_ID | ||
| AZURE_CLIENT_SECRET: $AZURE_CLIENT_SECRET | ||
| # add aws keys as dropwizard config | ||
| JAVA_OPTS: -Ddw.awsAccessKey=$AWS_ACCESS_KEY_ID -Ddw.awsSecretKey=$AWS_SECRET_ACCESS_KEY | ||
|
|
||
| healthcheck: | ||
| test: ["CMD", "curl", "http://localhost:8182/healthcheck"] | ||
| interval: 10s | ||
| timeout: 10s | ||
| retries: 5 | ||
|
|
||
| create-polaris-catalog: | ||
| image: curlimages/curl | ||
| depends_on: | ||
| polaris: | ||
| condition: service_healthy | ||
| volumes: | ||
| - ./create-polaris-catalog.sh:/create-polaris-catalog.sh | ||
| command: ["/bin/sh", "/create-polaris-catalog.sh"] | ||
|
|
||
| trino: | ||
| image: trinodb/trino:latest | ||
| ports: | ||
| - "8080:8080" | ||
| volumes: | ||
| - ./trino-config/catalog:/etc/trino/catalog | ||
25 changes: 25 additions & 0 deletions
25
getting-started/trino/trino-config/catalog/iceberg.properties
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
| # | ||
|
|
||
| connector.name=iceberg | ||
| iceberg.catalog.type=rest | ||
| iceberg.rest-catalog.uri=http://polaris:8181/api/catalog | ||
| iceberg.rest-catalog.security=OAUTH2 | ||
| iceberg.rest-catalog.oauth2.token=principal:root;realm:default-realm | ||
| iceberg.rest-catalog.warehouse=polaris |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this context work in your environment? I had do change it to
../../because Dockerfile exists in the project root directory.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're right, this should be
../../, it was accidentally removed when i copied over the new setup in 9c2be7fThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated! thanks