From d9a9cd19507856cd81972c05cef89a351c033b7d Mon Sep 17 00:00:00 2001 From: jun Date: Mon, 11 Nov 2024 17:54:07 +0800 Subject: [PATCH] update readme --- README.md | 141 ++++++++++++++++++++++++++---------------------------- 1 file changed, 67 insertions(+), 74 deletions(-) diff --git a/README.md b/README.md index 377b5c4..765dfcc 100644 --- a/README.md +++ b/README.md @@ -36,21 +36,20 @@ Docker Desktop (or Orbstack) with Kubernetes enabled and helm CLI is required if The playground runs several services. The TCP ports used may clash with existing services you run, such as MySQL or Postgres. -| Docker container | Ports used | -| --------------------- | ---------------------- | -| playground-gravitino | 8090 9001 | -| playground-hive | 3307 19000 19083 60070 | -| playground-mysql | 13306 | -| playground-postgresql | 15342 | -| playground-trino | 18080 | -| playground-jupyter | 18888 | -| playground-prometheus | 19090 | -| playground-grafana | 13000 | +| Docker container | Ports used | +| --------------------- | ------------------------------- | +| playground-gravitino | 8090 9001 | +| playground-hive | 3307 10000 19000 19083 60070 | +| playground-mysql | 13306 | +| playground-postgresql | 15432 | +| playground-trino | 18080 | +| playground-spark | 14040 | +| playground-jupyter | 18888 | +| playground-prometheus | 19090 | +| playground-grafana | 13000 | ## Playground usage - - ### One curl command launch playground ```shell /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/apache/gravitino-playground/HEAD/install.sh)" @@ -63,100 +62,85 @@ git clone git@github.com:apache/gravitino-playground.git cd gravitino-playground ``` -#### Docker +### Commands -##### Start +Command will be automatically detected runtime environment and execute corresponding commands. -``` -./playground.sh docker start -``` +#### Start -##### Check status -```shell -./playground.sh docker status -``` -##### Stop playground ```shell -./playground.sh docker stop +./playground.sh start ``` -#### Kubernetes - -Enable Kubernetes in Docker Desktop or Orbstack. - -In the project root directory, execute this command: - +#### Check status +```shell +./playground.sh status ``` -helm upgrade --install gravitino-playground ./helm-chart/ --create-namespace --namespace gravitino-playground --set projectRoot=$(pwd) + +#### Stop +```shell +./playground.sh stop ``` -##### Start +### Port Forwarding -``` -./playground.sh k8s start -``` +#### Docker -##### Check status -```shell -./playground.sh k8s status -``` +Will actomaticaly forward the ports to localhost. -##### Port Forwarding +#### Kubernetes -To access the pods or services at `localhost`, you need to do these steps: +Currently, need to manually port-forward the ports to localhost. -1. Log in to the Gravitino playground Trino pod using the following command: +command format: `kubectl port-forward svc/ -n :` -``` -TRINO_POD=$(kubectl get pods --namespace gravitino-playground -l app=trino -o jsonpath="{.items[0].metadata.name}") -kubectl exec $TRINO_POD -n gravitino-playground -it -- /bin/bash -``` -2. Log in to the Gravitino playground Spark pod using the following command: +for example: -``` -SPARK_POD=$(kubectl get pods --namespace gravitino-playground -l app=spark -o jsonpath="{.items[0].metadata.name}") -kubectl exec $SPARK_POD -n gravitino-playground -it -- /bin/bash +```shell +# gravitino +kubectl port-forward svc/gravitino -n gravitino-playground 8090:8090 +# jupyternotebook +kubectl port-forward svc/jupyternotebook -n gravitino-playground 18888:18888 ``` -3. Port-forward the Gravitino service to access it at `localhost:8090`. +## Experiencing Apache Gravitino with Trino SQL -``` -kubectl port-forward svc/gravitino -n gravitino-playground 8090:8090 -``` +### Using Trino CLI -4. Port-forward the Jupyter Notebook service to access it at `localhost:8888`. +1. Login to the Gravitino playground Trino service using the following command: -``` -kubectl port-forward svc/jupyternotebook -n gravitino-playground 8888:8888 +```shell +# Docker +docker exec -it playground-trino bash ``` -##### Stop playground ```shell -./playground.sh k8s stop +# Kubernetes +TRINO_POD=$(kubectl get pods --namespace gravitino-playground -l app=trino -o jsonpath="{.items[0].metadata.name}") +kubectl exec $TRINO_POD -n gravitino-playground -it -- /bin/bash ``` +2. Open the Trino CLI in the container. +```shell +trino +``` +## Using Jupyter Notebook -## Experiencing Apache Gravitino with Trino SQL - -### Using Trino CLI in Docker Container - -1. Login to the Gravitino playground Trino Docker container using the following command: +first, port-forward the jupyternotebook service to localhost: ```shell -docker exec -it playground-trino bash -```` - -2. Open the Trino CLI in the container. +# Docker +# Not necessary, because it will be automatically forwarded to localhost +``` ```shell -trino@container_id:/$ trino +# Kubernetes +kubectl port-forward svc/jupyternotebook -n gravitino-playground 18888:18888 ``` -## Using Jupyter Notebook - -1. Open the Jupyter Notebook in the browser at [http://localhost:18888](http://localhost:18888). +1. Open the Jupyter Notebook in the browser [http://localhost:18888](http://localhost:18888). 2. Open the `gravitino-trino-example.ipynb` notebook. @@ -167,16 +151,25 @@ trino@container_id:/$ trino 1. Login to the Gravitino playground Spark Docker container using the following command: ```shell +# Docker docker exec -it playground-spark bash -```` +``` + +```shell +# Kubernetes +SPARK_POD=$(kubectl get pods --namespace gravitino-playground -l app=spark -o jsonpath="{.items[0].metadata.name}") +kubectl exec $SPARK_POD -n gravitino-playground -it -- /bin/bash +``` 2. Open the Spark SQL client in the container. ```shell -spark@container_id:/$ cd /opt/spark && /bin/bash bin/spark-sql +cd /opt/spark && /bin/bash bin/spark-sql ``` -## Monitoring Gravitino +## Monitoring Gravitino(Docker only) + +Currently, not supported in Kubernetes. 1. Open the Grafana in the browser at [http://localhost:13000](http://localhost:13000).