Quickstart

In this quickstart, we will download Druid and set it up on a single machine. The cluster will be ready to load data after completing this initial setup.

Before beginning the quickstart, it is helpful to read the general Druid overview and the ingestion overview, as the tutorials will refer to concepts discussed on those pages.

Prerequisites

Software

You will need:

  • Java 8 (8u92+) or later
  • Linux, Mac OS X, or other Unix-like OS (Windows is not supported)

Warning: Druid only officially supports Java 8. Any Java version later than 8 is still experimental.

If needed, you can specify where to find Java using the environment variables DRUID_JAVA_HOME or JAVA_HOME. For more details run the verify-java script.

Hardware

Druid includes several example single-server configurations, along with scripts to start the Druid processes using these configurations.

If you’re running on a small machine such as a laptop for a quick evaluation, the micro-quickstart configuration is a good choice, sized for a 4CPU/16GB RAM environment.

If you plan to use the single-machine deployment for further evaluation beyond the tutorials, we recommend a larger configuration than micro-quickstart.

Getting started

Download the 0.18.1 release.

Extract Druid by running the following commands in your terminal:

  1. tar -xzf apache-druid-0.18.1-bin.tar.gz
  2. cd apache-druid-0.18.1

In the package, you should find:

  • LICENSE and NOTICE files
  • bin/* - scripts useful for this quickstart
  • conf/* - example configurations for single-server and clustered setup
  • extensions/* - core Druid extensions
  • hadoop-dependencies/* - Druid Hadoop dependencies
  • lib/* - libraries and dependencies for core Druid
  • quickstart/* - configuration files, sample data, and other files for the quickstart tutorials

Start up Druid services

The following commands will assume that you are using the micro-quickstart single-machine configuration. If you are using a different configuration, the bin directory has equivalent scripts for each configuration, such as bin/start-single-server-small.

From the apache-druid-0.18.1 package root, run the following command:

  1. ./bin/start-micro-quickstart

This will bring up instances of ZooKeeper and the Druid services, all running on the local machine, e.g.:

  1. $ ./bin/start-micro-quickstart
  2. [Fri May 3 11:40:50 2019] Running command[zk], logging to[/apache-druid-0.18.1/var/sv/zk.log]: bin/run-zk conf
  3. [Fri May 3 11:40:50 2019] Running command[coordinator-overlord], logging to[/apache-druid-0.18.1/var/sv/coordinator-overlord.log]: bin/run-druid coordinator-overlord conf/druid/single-server/micro-quickstart
  4. [Fri May 3 11:40:50 2019] Running command[broker], logging to[/apache-druid-0.18.1/var/sv/broker.log]: bin/run-druid broker conf/druid/single-server/micro-quickstart
  5. [Fri May 3 11:40:50 2019] Running command[router], logging to[/apache-druid-0.18.1/var/sv/router.log]: bin/run-druid router conf/druid/single-server/micro-quickstart
  6. [Fri May 3 11:40:50 2019] Running command[historical], logging to[/apache-druid-0.18.1/var/sv/historical.log]: bin/run-druid historical conf/druid/single-server/micro-quickstart
  7. [Fri May 3 11:40:50 2019] Running command[middleManager], logging to[/apache-druid-0.18.1/var/sv/middleManager.log]: bin/run-druid middleManager conf/druid/single-server/micro-quickstart

All persistent state such as the cluster metadata store and segments for the services will be kept in the var directory under the apache-druid-0.18.1 package root. Logs for the services are located at var/sv.

Later on, if you’d like to stop the services, CTRL-C to exit the bin/start-micro-quickstart script, which will terminate the Druid processes.

Once the cluster has started, you can navigate to http://localhost:8888. The Druid router process, which serves the Druid console, resides at this address.

Druid console

It takes a few seconds for all the Druid processes to fully start up. If you open the console immediately after starting the services, you may see some errors that you can safely ignore.

Loading data

Tutorial dataset

For the following data loading tutorials, we have included a sample data file containing Wikipedia page edit events that occurred on 2015-09-12.

This sample data is located at quickstart/tutorial/wikiticker-2015-09-12-sampled.json.gz from the Druid package root. The page edit events are stored as JSON objects in a text file.

The sample data has the following columns, and an example event is shown below:

  • added
  • channel
  • cityName
  • comment
  • countryIsoCode
  • countryName
  • deleted
  • delta
  • isAnonymous
  • isMinor
  • isNew
  • isRobot
  • isUnpatrolled
  • metroCode
  • namespace
  • page
  • regionIsoCode
  • regionName
  • user
  1. {
  2. "timestamp":"2015-09-12T20:03:45.018Z",
  3. "channel":"#en.wikipedia",
  4. "namespace":"Main",
  5. "page":"Spider-Man's powers and equipment",
  6. "user":"foobar",
  7. "comment":"/* Artificial web-shooters */",
  8. "cityName":"New York",
  9. "regionName":"New York",
  10. "regionIsoCode":"NY",
  11. "countryName":"United States",
  12. "countryIsoCode":"US",
  13. "isAnonymous":false,
  14. "isNew":false,
  15. "isMinor":false,
  16. "isRobot":false,
  17. "isUnpatrolled":false,
  18. "added":99,
  19. "delta":99,
  20. "deleted":0,
  21. }

Data loading tutorials

The following tutorials demonstrate various methods of loading data into Druid, including both batch and streaming use cases. All tutorials assume that you are using the micro-quickstart single-machine configuration mentioned above.

Resetting cluster state

If you want a clean start after stopping the services, delete the var directory and run the bin/start-micro-quickstart script again.

Once every service has started, you are now ready to load data.

Resetting Kafka

If you completed Tutorial: Loading stream data from Kafka and wish to reset the cluster state, you should additionally clear out any Kafka state.

Shut down the Kafka broker with CTRL-C before stopping ZooKeeper and the Druid services, and then delete the Kafka log directory at /tmp/kafka-logs:

  1. rm -rf /tmp/kafka-logs