From the apache-druid-apache-druid-0.21.1 package root, run the following commands to build a Docker image named "druid-hadoop-demo" with version tag "2.8.5":
This will start building the Hadoop image. Once the image build is done, you should see the message `Successfully tagged druid-hadoop-demo:2.8.5` printed to the console.
## Setup the Hadoop docker cluster
### Create temporary shared directory
We'll need a shared folder between the host and the Hadoop container for transferring some files.
Let's create some folders under `/tmp`, we will use these later when starting the Hadoop container:
```bash
mkdir -p /tmp/shared
mkdir -p /tmp/shared/hadoop_xml
```
### Configure /etc/hosts
On the host machine, add the following entry to `/etc/hosts`:
```
127.0.0.1 druid-hadoop-demo
```
### Start the Hadoop container
Once the `/tmp/shared` folder has been created and the `etc/hosts` entry has been added, run the following command to start the Hadoop container.
From the apache-druid-apache-druid-0.21.1 package root on the host, copy the `quickstart/tutorial/wikiticker-2015-09-12-sampled.json.gz` sample data to the shared folder:
If you encounter namenode errors when running this command, the Hadoop container may not be finished initializing. When this occurs, wait a couple of minutes and retry the commands.
## Configure Druid to use Hadoop
Some additional steps are needed to configure the Druid cluster for Hadoop batch indexing.
### Copy Hadoop configuration to Druid classpath
From the Hadoop container's shell, run the following command to copy the Hadoop .xml configuration files to the shared folder:
Once the Hadoop .xml files have been copied to the Druid cluster and the segment/log storage configuration has been updated to use HDFS, the Druid cluster needs to be restarted for the new configurations to take effect.
If the cluster is still running, CTRL-C to terminate the `bin/start-micro-quickstart` script, and re-run it to bring the Druid services back up.
## Load batch data
We've included a sample of Wikipedia edits from September 12, 2015 to get you started.
To load this data into Druid, you can submit an *ingestion task* pointing to the file. We've included
a task that loads the `wikiticker-2015-09-12-sampled.json.gz` file included in the archive.
Let's submit the `wikipedia-index-hadoop-.json` task:
After the data load is complete, please follow the [query tutorial](../tutorials/tutorial-query.md) to run some example queries on the newly loaded data.
## Cleanup
This tutorial is only meant to be used together with the [query tutorial](../tutorials/tutorial-query.md).
If you wish to go through any of the other tutorials, you will need to:
* Shut down the cluster and reset the cluster state by removing the contents of the `var` directory under the druid package.
* Revert the deep storage and task storage config back to local types in `conf/druid/single-server/micro-quickstart/_common/common.runtime.properties`
* Restart the cluster
This is necessary because the other ingestion tutorials will write to the same "wikipedia" datasource, and later tutorials expect the cluster to use local deep storage.
Example reverted config:
```
#
# Deep storage
#
# For local disk (only viable in a cluster if this is a network mount):
druid.storage.type=local
druid.storage.storageDirectory=var/druid/segments
# For HDFS:
#druid.storage.type=hdfs
#druid.storage.storageDirectory=/druid/segments
#
# Indexing service logs
#
# For local disk (only viable in a cluster if this is a network mount):