Running Pinot in Kubernetes
This QuickStart assumes the existence of Kubernetes Cluster. Please follow below links to setup your Kubernetes cluster in local or major cloud vendors.
Prerequisites:Enable Kubernetes on Docker-Desktop
Setup a Kubernetes Cluster using Amazon Elastic Kubernetes Service (Amazon EKS)
Setup a Kubernetes Cluster using Google Kubernetes Engine(GKE)
Setup a Kubernetes Cluster using Azure Kubernetes Service (AKS)
Setup a Pinot cluster for demo
Update helm dependency
helm dependency updateStart Pinot with Helm
- For Helm v2.12.1
If cluster is just initialized, ensure helm is initialized by running:
helm init --service-account tillerThen deploy pinot cluster by:
helm install --namespace "pinot-quickstart" --name "pinot" .- For Helm v3.0.0
kubectl create ns pinot-quickstarthelm install -n pinot-quickstart pinot .Troubleshooting (For helm v2.12.1)
- Error: Please run below command if encountering issue:
Error: could not find tiller".- Resolution:
kubectl -n kube-system delete deployment tiller-deploykubectl -n kube-system delete service/tiller-deployhelm init --service-account tiller- Error: Please run below command if encountering permission issue:
Error: release pinot failed: namespaces "pinot-quickstart" is forbidden: User "system:serviceaccount:kube-system:default" cannot get resource "namespaces" in API group "" in the namespace "pinot-quickstart"- Resolution:
kubectl apply -f helm-rbac.yaml- Check deployment status
kubectl get all -n pinot-quickstartLoad data into Pinot through Kafka
Bring up a Kafka Cluster for realtime data ingestion
- For helm v2.12.1
helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubatorhelm install --namespace "pinot-quickstart" --name kafka incubator/kafka- For helm v3.0.0
helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubatorhelm install -n pinot-quickstart kafka incubator/kafka --set replicas=1Check Kafka deployment status
kubectl get all -n pinot-quickstart |grep kafkaEnsure Kafka deployment is ready before executing the scripts in next steps:
pod/kafka-0 1/1 Running 0 2mpod/kafka-zookeeper-0 1/1 Running 0 10mpod/kafka-zookeeper-1 1/1 Running 0 9mpod/kafka-zookeeper-2 1/1 Running 0 8mCreate Kafka topics
Below scripts will create two Kafka topics for data ingestion:
kubectl -n pinot-quickstart exec kafka-0 -- kafka-topics --zookeeper kafka-zookeeper:2181 --topic flights-realtime --create --partitions 1 --replication-factor 1kubectl -n pinot-quickstart exec kafka-0 -- kafka-topics --zookeeper kafka-zookeeper:2181 --topic flights-realtime-avro --create --partitions 1 --replication-factor 1Load data into Kafka and Create Pinot Schema/Tables
Below script will deploy 3 batch jobs
- Ingest 19492 Json messages to Kafka topic
flights-realtimeat a speed of 1 msg/sec - Ingest 19492 Avro messages to Kafka topic
flights-realtime-avroat a speed of 1 msg/sec - Upload Pinot schema
airlineStats - Create Pinot Table
airlineStatsto ingest data from Json encoded Kafka topicflights-realtime - Create Pinot Table
airlineStatsAvroto ingest data from Avro encoded Kafka topicflights-realtime-avro
kubectl apply -f pinot-realtime-quickstart.ymlHow to query pinot data
Pinot Query Console
Please use below script to do local port-forwarding and open Pinot query console on your web browser.
./query-pinot-data.shUse Superset to query Pinot
Bring up Superset
kubectl apply -f superset.yaml(First time) Set up Admin account
kubectl exec -it pod/superset-0 -n pinot-quickstart -- bash -c 'export FLASK_APP=superset:app && flask fab create-admin'(First time) Init Superset
kubectl exec -it pod/superset-0 -n pinot-quickstart -- bash -c 'superset db upgrade'kubectl exec -it pod/superset-0 -n pinot-quickstart -- bash -c 'superset init'Load Demo Data source
kubectl exec -it pod/superset-0 -n pinot-quickstart -- bash -c 'superset import_datasources -p /etc/superset/pinot_example_datasource.yaml'kubectl exec -it pod/superset-0 -n pinot-quickstart -- bash -c 'superset import_dashboards -p /etc/superset/pinot_example_dashboard.json'Access Superset UI
./open-superset-ui.shYou can open the imported dashboard by click Dashboards banner then click on AirlineStats.
Access Pinot Using Presto
Deploy Presto with Pinot Plugin
You can run below command to deploy a customized Presto with Pinot plugin.
kubectl apply -f presto-coordinator.yamlQuery Presto using Presto CLI
Once Presto is deployed, you could run below command.
./pinot-presto-cli.shSample queries to execute
- List all catalogs
presto:default> show catalogs;Catalog--------- pinot system(2 rows)
Query 20191112_050827_00003_xkm4g, FINISHED, 1 nodeSplits: 19 total, 19 done (100.00%)0:01 [0 rows, 0B] [0 rows/s, 0B/s]- List All tables
presto:default> show tables; Table-------------- airlinestats(1 row)
Query 20191112_050907_00004_xkm4g, FINISHED, 1 nodeSplits: 19 total, 19 done (100.00%)0:01 [1 rows, 29B] [1 rows/s, 41B/s]- Show schema
presto:default> DESCRIBE pinot.dontcare.airlinestats; Column | Type | Extra | Comment----------------------+---------+-------+--------- flightnum | integer | | origin | varchar | | quarter | integer | | lateaircraftdelay | integer | | divactualelapsedtime | integer | |......
Query 20191112_051021_00005_xkm4g, FINISHED, 1 nodeSplits: 19 total, 19 done (100.00%)0:02 [80 rows, 6.06KB] [35 rows/s, 2.66KB/s]- Count total documents
presto:default> select count(*) as cnt from pinot.dontcare.airlinestats limit 10; cnt------ 9745(1 row)
Query 20191112_051114_00006_xkm4g, FINISHED, 1 nodeSplits: 17 total, 17 done (100.00%)0:00 [1 rows, 8B] [2 rows/s, 19B/s]How to clean up Pinot deployment
kubectl delete ns pinot-quickstart