Skip to content

yatesliang/druid-docker

Repository files navigation

Druid + Kafka + Grafana

Deployment

Config Env

  1. Follow the official instruction to nstall docker & docker-compose. If you are using the *nix system with apt, just type the following commands:
sudo apt install docker
sudo apt install docker-compose

Build Image

  1. Download this repo to your machine.
  2. Enter druid_docker folder in terminal and run the following commands to build the docker image with the file docker-compose.yml:
sudo docker-compose up -d

This may take a while to fetch and build the docker image, you can get yourself a cup of coffee and wait :)

Create Kafka Topic

  1. Check if all the components are running
sudo docker ps
  1. Create your Kafka topic, replace the topic_name with your unique topic name. You can learm more about Kafka concepts from its offcial site
sudo docker exec -it druid-docker_kafka_1 /opt/kafka/bin/kafka-topics.sh --create --topic [topic_name] --partitions 4 --zookeeper zookeeper_kafka:2181 --replication-factor 1

Example:

sudo docker exec -it druid-docker_kafka_1 /opt/kafka/bin/kafka-topics.sh --create --topic test_topic --partitions 4 --zookeeper zookeeper_kafka:2181 --replication-factor 1

You will get a result says:

Created topic test_topic.

  1. test_producer.py and test_consumer.py provide a simple producer and consumer. Replace the topic name in these two files with the topic you just created and run them to check if your Kafka words.

The consumer will keep listening the topic, so you need to open another terminal to run the producer. Each time you call the producer, your consumer is expected to receive a message.

Access Druid Console

  1. In docker-compose.yml , router of Druid runs in port 9999, so open your browser and type http://localhost:9999, you will be able to access the Druid console. The Druid is successfully running on your machine if you can see the console page.

Access Grafana

  1. Open http://localhost:3000, you will see the grafana login page. Your username and password will be admin as default.

Shutdown Cluster

  1. You can use the following command to stop all the containers after finish using the druid.
sudo docker-compose down

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published