Skip to content
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

Added server health checks, tune controller and broker health checks. #5

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 32 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
GREEN=\033[0;32m
NC=\033[0m # No Color

base: create tables import info

schema:
Expand All @@ -11,9 +14,10 @@ schema:
-dimensions=""

create:
docker compose build --no-cache
# docker compose build --no-cache
docker compose up -d
@echo "Waiting for Pinot Controller to be ready..."
@echo "------------------------------------------------"
@echo "\n⏳ Waiting for Pinot Controller to be ready..."
@while true; do \
STATUS_CODE=$$(curl -s -o /dev/null -w '%{http_code}' \
'http://localhost:9000/health'); \
Expand All @@ -23,9 +27,9 @@ create:
sleep 2; \
echo "Waiting for Pinot Controller..."; \
done
@echo "🍷 Pinot Controller is ready."
@printf "$(GREEN)✔$(NC) 🍷🕺 Pinot Controller is ready!\n"

@echo "Waiting for Pinot Broker to be ready..."
@echo "\n⏳ Waiting for Pinot Broker to be ready..."
@while true; do \
STATUS_CODE=$$(curl -s -o /dev/null -w '%{http_code}' \
'http://localhost:8099/health'); \
Expand All @@ -35,14 +39,26 @@ create:
sleep 1; \
echo "Waiting for Pinot Broker..."; \
done
@echo "🍷 Pinot Broker is ready to receive queries."

@echo "🪲 Waiting for Kafka to be ready..."
@printf "$(GREEN)✔$(NC) 🍷💁 Pinot Broker is ready to receive queries!\n"

@echo "\n⏳ Waiting for Pinot Server to be ready..."
@while true; do \
STATUS_CODE=$$(curl -s -o /dev/null -w '%{http_code}' \
'http://localhost:8097/health/readiness'); \
if [ "$$STATUS_CODE" -eq 200 ]; then \
break; \
fi; \
sleep 1; \
echo "Waiting for Pinot Server..."; \
done
@printf "$(GREEN)✔$(NC) 🍷👩‍🔧 Pinot Server is ready to receive requests!\n"

@echo "\n⏳ Waiting for Kafka to be ready..."
@while ! nc -z localhost 9092; do \
sleep 1; \
echo "Waiting for Kafka..."; \
done
@echo "🪲 Kafka is ready."
@printf "$(GREEN)✔$(NC) 🪲 Kafka is ready!\n"

topic:
docker exec kafka kafka-topics.sh \
Expand All @@ -51,21 +67,22 @@ topic:
--topic movie_ratings

tables:
docker exec pinot-controller ./bin/pinot-admin.sh \
@echo "\n 🎥 Creating movies table..."
@docker exec pinot-controller ./bin/pinot-admin.sh \
AddTable \
-tableConfigFile /tmp/pinot/table/movies.table.json \
-schemaFile /tmp/pinot/table/movies.schema.json \
-exec

sleep 5

docker exec pinot-controller ./bin/pinot-admin.sh \
@echo "\n 🍿 Creating ratings table..."
@docker exec pinot-controller ./bin/pinot-admin.sh \
AddTable \
-tableConfigFile /tmp/pinot/table/ratings.table.json \
-schemaFile /tmp/pinot/table/ratings.schema.json \
-exec

import:
docker exec pinot-controller ./bin/pinot-admin.sh \
@docker exec pinot-controller ./bin/pinot-admin.sh \
LaunchDataIngestionJob \
-jobSpecFile /tmp/pinot/table/jobspec.yaml

Expand All @@ -91,7 +108,9 @@ validate:
fi

info:
@printf "\n==========================================================\n"
@printf "🍷 Pinot Query UI - \033[4mhttp://localhost:9000\033[0m\n"
@printf "==========================================================\n"

destroy:
docker compose down -v
Expand Down
23 changes: 15 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ services:
ports:
- "9000:9000"
environment:
JAVA_OPTS: "-Dplugins.dir=/opt/pinot/plugins -Xms1G -Xmx4G -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -Xloggc:gc-pinot-controller.log"
JAVA_OPTS: "-Dplugins.dir=/opt/pinot/plugins -Xms1G -Xmx4G -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -Xlog:gc:gc-pinot-controller.log"
depends_on:
- pinot-zookeeper
healthcheck:
test: [ "CMD-SHELL", "curl -f http://localhost:9000/health || exit 1" ]
interval: 30s
interval: 10s
timeout: 10s
retries: 3
retries: 5
start_period: 10s
volumes:
- ./table/:/tmp/pinot/table/
Expand All @@ -54,28 +54,35 @@ services:
ports:
- "8099:8099"
environment:
JAVA_OPTS: "-Dplugins.dir=/opt/pinot/plugins -Xms4G -Xmx4G -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -Xloggc:gc-pinot-broker.log"
JAVA_OPTS: "-Dplugins.dir=/opt/pinot/plugins -Xms4G -Xmx4G -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -Xlog:gc:gc-pinot-broker.log"
depends_on:
pinot-controller:
condition: service_healthy
healthcheck:
test: [ "CMD-SHELL", "curl -f http://localhost:8099/health || exit 1" ]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
retries: 5
start_period: 30s

pinot-server:
image: apachepinot/pinot:1.1.0-21-openjdk
command: "StartServer -zkAddress pinot-zookeeper:2181"
restart: unless-stopped
container_name: "pinot-server"
ports:
- "8097:8097"
- "8098:8098"
environment:
JAVA_OPTS: "-Dplugins.dir=/opt/pinot/plugins -Xms4G -Xmx16G -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -Xloggc:gc-pinot-server.log"
JAVA_OPTS: "-Dplugins.dir=/opt/pinot/plugins -Xms4G -Xmx16G -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -Xlog:gc:gc-pinot-server.log"
healthcheck:
test: [ "CMD-SHELL", "curl -f http://localhost:8097/health/readiness || exit 1" ]
interval: 30s
timeout: 10s
retries: 5
start_period: 10s
depends_on:
pinot-broker:
pinot-controller:
condition: service_healthy

kafka:
Expand Down