First steps
After going through the Installation section and having installed all the operators, you will now deploy a Trino cluster and the required dependencies. Afterwards you can verify that it works by running some queries against Trino or visit the Trino web interface.
Setup Trino
A working Trino cluster and its web interface require only the commons and secret operators to work. Simple tests are possible without an external data source (e.g. PostgreSQL, Hive or S3), as internal data can be used.
Create a file named trino.yaml
with the following content:
---
apiVersion: trino.stackable.tech/v1alpha1
kind: TrinoCluster
metadata:
name: simple-trino
spec:
image:
productVersion: "396"
stackableVersion: "23.4.0-rc2"
clusterConfig:
catalogLabelSelector:
matchLabels:
trino: simple-trino
coordinators:
roleGroups:
default:
replicas: 1
workers:
roleGroups:
default:
replicas: 1
and apply it:
kubectl apply -f trino.yaml
Wait for the Trino cluster to get ready:
kubectl rollout status --watch --timeout=5m statefulset/simple-trino-coordinator-default
kubectl rollout status --watch --timeout=5m statefulset/simple-trino-worker-default
Verify that it works
At first, make sure the StatefulSets are ready:
kubectl get statefulset
The output should show all pods in the StatefulSets ready:
NAME READY AGE
simple-trino-coordinator-default 1/1 5m
simple-trino-worker-default 1/1 5m
Create a port-forward for the coordinator to access Trino easily in the next steps:
kubectl port-forward svc/simple-trino-coordinator 8443 2>&1 >/dev/null &
Access the Trino cluster via CLI tool
We use the Trino CLI tool to access the Trino cluster. This link points to the latest Trino version. In this guide we keep Trino cluster and client versions in sync and download the CLI tool from the Stackable repository:
curl --output trino.jar https://repo.stackable.tech/repository/packages/trino-cli/trino-cli-396-executable.jar
We need to make the CLI tool executable:
chmod +x trino.jar
Now, run some queries against the coordinator. Show available catalogs:
./trino.jar --insecure --output-format=CSV_UNQUOTED --server https://localhost:8443 --user admin --execute "SHOW CATALOGS"
which should output:
system
Check how many workers are connected to the coordinator:
./trino.jar --insecure --output-format=CSV_UNQUOTED --server https://localhost:8443 --user admin --execute "SELECT COUNT(*) as nodes FROM system.runtime.nodes WHERE coordinator=false AND state='active'"
which should output:
1
Congratulations, you set up your first Stackable Trino cluster successfully.
Access the Trino web interface
With the port-forward still active, you can connect to the Trino web interface. Enter https://localhost:8443/ui
in your browser and login with the username admin
. Since no authentication is enabled you do not need to enter a password.
Your browser will probably show a security risk warning because it does not trust the self generated TLS certificates. Just ignore that and continue. |
After logging in you should see the Trino web interface:
![trino web ui](../_images/trino-web-ui.png)
If you mark the Finished
button in the Query Details
section, you should see the two queries that were sent earlier via the CLI tool:
![trino web ui finished](../_images/trino-web-ui-finished.png)
Clean up
In order to remove the previously downloaded CLI tool, you can safely remove it from your system:
rm trino.jar
What’s next
Have a look at the Usage guide to find out more about how to configure a Trino cluster.