mirror of https://github.com/apache/druid.git
add docker tutorial, friendlier docker-compose.yml, experimental java 11 dockerfile (#9262)
* add docker tutorial, experimental java 11 dockerfile * fix typo * spelling * doc adjustments
This commit is contained in:
parent
4221573317
commit
2e54755a03
|
@ -0,0 +1,67 @@
|
||||||
|
#
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
# or more contributor license agreements. See the NOTICE file
|
||||||
|
# distributed with this work for additional information
|
||||||
|
# regarding copyright ownership. The ASF licenses this file
|
||||||
|
# to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance
|
||||||
|
# with the License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing,
|
||||||
|
# software distributed under the License is distributed on an
|
||||||
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
# KIND, either express or implied. See the License for the
|
||||||
|
# specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
FROM maven:3-jdk-11-slim as builder
|
||||||
|
|
||||||
|
RUN export DEBIAN_FRONTEND=noninteractive \
|
||||||
|
&& apt-get -qq update \
|
||||||
|
&& apt-get -qq -y install --no-install-recommends python3 python3-yaml
|
||||||
|
|
||||||
|
COPY . /src
|
||||||
|
WORKDIR /src
|
||||||
|
RUN mvn -B -ff -q dependency:go-offline \
|
||||||
|
install \
|
||||||
|
-Pdist,bundle-contrib-exts \
|
||||||
|
-DskipTests \
|
||||||
|
-Danimal.sniffer.skip=true \
|
||||||
|
-Dcheckstyle.skip=true \
|
||||||
|
-Denforcer.skip=true \
|
||||||
|
-Dforbiddenapis.skip=true \
|
||||||
|
-Dmaven.javadoc.skip=true \
|
||||||
|
-Dpmd.skip=true \
|
||||||
|
-Dspotbugs.skip=true
|
||||||
|
|
||||||
|
RUN VERSION=$(mvn -B -q org.apache.maven.plugins:maven-help-plugin:3.1.1:evaluate \
|
||||||
|
-Dexpression=project.version -DforceStdout=true \
|
||||||
|
) \
|
||||||
|
&& tar -zxf ./distribution/target/apache-druid-${VERSION}-bin.tar.gz -C /opt \
|
||||||
|
&& ln -s /opt/apache-druid-${VERSION} /opt/druid
|
||||||
|
|
||||||
|
FROM amd64/busybox:1.30.0-glibc as busybox
|
||||||
|
|
||||||
|
FROM gcr.io/distroless/java:11
|
||||||
|
LABEL maintainer="Apache Druid Developers <dev@druid.apache.org>"
|
||||||
|
|
||||||
|
COPY --from=busybox /bin/busybox /busybox/busybox
|
||||||
|
RUN ["/busybox/busybox", "--install", "/bin"]
|
||||||
|
|
||||||
|
COPY --from=builder /opt /opt
|
||||||
|
COPY distribution/docker/druid.sh /druid.sh
|
||||||
|
|
||||||
|
RUN addgroup -S -g 1000 druid \
|
||||||
|
&& adduser -S -u 1000 -D -H -h /opt/druid -s /bin/sh -g '' -G druid druid \
|
||||||
|
&& mkdir -p /opt/druid/var \
|
||||||
|
&& chown -R druid:druid /opt \
|
||||||
|
&& chmod 775 /opt/druid/var
|
||||||
|
|
||||||
|
USER druid
|
||||||
|
VOLUME /opt/druid/var
|
||||||
|
WORKDIR /opt/druid
|
||||||
|
|
||||||
|
ENTRYPOINT ["/druid.sh"]
|
|
@ -25,6 +25,10 @@ From the root of the repo, run `docker build -t apache/druid:tag -f distribution
|
||||||
|
|
||||||
Edit `environment` to suite. Run `docker-compose -f distribution/docker/docker-compose.yml up`
|
Edit `environment` to suite. Run `docker-compose -f distribution/docker/docker-compose.yml up`
|
||||||
|
|
||||||
|
## Java 11 (experimental)
|
||||||
|
|
||||||
|
From the root of the repo, run `docker build -t apache/druid:tag -f distribution/docker/Dockerfile.java11 .` which will build Druid to run in a Java 11 environment.
|
||||||
|
|
||||||
## MySQL Database Connector
|
## MySQL Database Connector
|
||||||
|
|
||||||
This image contains solely the postgres metadata storage connector. If you
|
This image contains solely the postgres metadata storage connector. If you
|
||||||
|
|
|
@ -24,9 +24,9 @@ volumes:
|
||||||
historical_var: {}
|
historical_var: {}
|
||||||
broker_var: {}
|
broker_var: {}
|
||||||
coordinator_var: {}
|
coordinator_var: {}
|
||||||
overlord_var: {}
|
|
||||||
router_var: {}
|
router_var: {}
|
||||||
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
container_name: postgres
|
container_name: postgres
|
||||||
|
@ -46,22 +46,23 @@ services:
|
||||||
- ZOO_MY_ID=1
|
- ZOO_MY_ID=1
|
||||||
|
|
||||||
coordinator:
|
coordinator:
|
||||||
image: apache/druid
|
image: apache/druid:0.17.0
|
||||||
container_name: coordinator
|
container_name: coordinator
|
||||||
volumes:
|
volumes:
|
||||||
|
- ./storage:/opt/data
|
||||||
- coordinator_var:/opt/druid/var
|
- coordinator_var:/opt/druid/var
|
||||||
depends_on:
|
depends_on:
|
||||||
- zookeeper
|
- zookeeper
|
||||||
- postgres
|
- postgres
|
||||||
ports:
|
ports:
|
||||||
- "3001:8081"
|
- "8081:8081"
|
||||||
command:
|
command:
|
||||||
- coordinator
|
- coordinator
|
||||||
env_file:
|
env_file:
|
||||||
- environment
|
- environment
|
||||||
|
|
||||||
broker:
|
broker:
|
||||||
image: apache/druid
|
image: apache/druid:0.17.0
|
||||||
container_name: broker
|
container_name: broker
|
||||||
volumes:
|
volumes:
|
||||||
- broker_var:/opt/druid/var
|
- broker_var:/opt/druid/var
|
||||||
|
@ -70,61 +71,48 @@ services:
|
||||||
- postgres
|
- postgres
|
||||||
- coordinator
|
- coordinator
|
||||||
ports:
|
ports:
|
||||||
- "3002:8082"
|
- "8082:8082"
|
||||||
command:
|
command:
|
||||||
- broker
|
- broker
|
||||||
env_file:
|
env_file:
|
||||||
- environment
|
- environment
|
||||||
|
|
||||||
historical:
|
historical:
|
||||||
image: apache/druid
|
image: apache/druid:0.17.0
|
||||||
container_name: historical
|
container_name: historical
|
||||||
volumes:
|
volumes:
|
||||||
|
- ./storage:/opt/data
|
||||||
- historical_var:/opt/druid/var
|
- historical_var:/opt/druid/var
|
||||||
depends_on:
|
depends_on:
|
||||||
- zookeeper
|
- zookeeper
|
||||||
- postgres
|
- postgres
|
||||||
- coordinator
|
- coordinator
|
||||||
ports:
|
ports:
|
||||||
- "3003:8083"
|
- "8083:8083"
|
||||||
command:
|
command:
|
||||||
- historical
|
- historical
|
||||||
env_file:
|
env_file:
|
||||||
- environment
|
- environment
|
||||||
|
|
||||||
overlord:
|
|
||||||
image: apache/druid
|
|
||||||
container_name: overlord
|
|
||||||
volumes:
|
|
||||||
- overlord_var:/opt/druid/var
|
|
||||||
depends_on:
|
|
||||||
- zookeeper
|
|
||||||
- postgres
|
|
||||||
ports:
|
|
||||||
- "4000:8090"
|
|
||||||
command:
|
|
||||||
- overlord
|
|
||||||
env_file:
|
|
||||||
- environment
|
|
||||||
|
|
||||||
middlemanager:
|
middlemanager:
|
||||||
image: apache/druid
|
image: apache/druid:0.17.0
|
||||||
container_name: middlemanager
|
container_name: middlemanager
|
||||||
volumes:
|
volumes:
|
||||||
|
- ./storage:/opt/data
|
||||||
- middle_var:/opt/druid/var
|
- middle_var:/opt/druid/var
|
||||||
depends_on:
|
depends_on:
|
||||||
- zookeeper
|
- zookeeper
|
||||||
- postgres
|
- postgres
|
||||||
- coordinator
|
- coordinator
|
||||||
ports:
|
ports:
|
||||||
- "4001:8091"
|
- "8091:8091"
|
||||||
command:
|
command:
|
||||||
- middleManager
|
- middleManager
|
||||||
env_file:
|
env_file:
|
||||||
- environment
|
- environment
|
||||||
|
|
||||||
router:
|
router:
|
||||||
image: apache/druid
|
image: apache/druid:0.17.0
|
||||||
container_name: router
|
container_name: router
|
||||||
volumes:
|
volumes:
|
||||||
- router_var:/opt/druid/var
|
- router_var:/opt/druid/var
|
||||||
|
@ -133,7 +121,7 @@ services:
|
||||||
- postgres
|
- postgres
|
||||||
- coordinator
|
- coordinator
|
||||||
ports:
|
ports:
|
||||||
- "4008:8888"
|
- "8888:8888"
|
||||||
command:
|
command:
|
||||||
- router
|
- router
|
||||||
env_file:
|
env_file:
|
||||||
|
|
|
@ -26,7 +26,7 @@ DRUID_MAXDIRECTMEMORYSIZE=6172m
|
||||||
|
|
||||||
druid_emitter_logging_logLevel=debug
|
druid_emitter_logging_logLevel=debug
|
||||||
|
|
||||||
druid_extensions_loadList=["druid-histogram", "druid-datasketches", "druid-lookups-cached-global", "druid-azure-extensions", "postgresql-metadata-storage"]
|
druid_extensions_loadList=["druid-histogram", "druid-datasketches", "druid-lookups-cached-global", "postgresql-metadata-storage"]
|
||||||
|
|
||||||
druid_zk_service_host=zookeeper
|
druid_zk_service_host=zookeeper
|
||||||
|
|
||||||
|
@ -41,11 +41,12 @@ druid_coordinator_balancer_strategy=cachingCost
|
||||||
druid_indexer_runner_javaOptsArray=["-server", "-Xmx1g", "-Xms1g", "-XX:MaxDirectMemorySize=3g", "-Duser.timezone=UTC", "-Dfile.encoding=UTF-8", "-Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager"]
|
druid_indexer_runner_javaOptsArray=["-server", "-Xmx1g", "-Xms1g", "-XX:MaxDirectMemorySize=3g", "-Duser.timezone=UTC", "-Dfile.encoding=UTF-8", "-Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager"]
|
||||||
druid_indexer_fork_property_druid_processing_buffer_sizeBytes=268435456
|
druid_indexer_fork_property_druid_processing_buffer_sizeBytes=268435456
|
||||||
|
|
||||||
druid_storage_type=azure
|
druid_storage_type=local
|
||||||
druid_azure_account=YOURACCOUNT
|
druid_storage_storageDirectory=/opt/data/segments
|
||||||
druid_azure_key=YOURKEY
|
druid_indexer_logs_type=file
|
||||||
druid_azure_container=druid
|
druid_indexer_logs_directory=/opt/data/indexing-logs
|
||||||
druid_azure_protocol=https
|
|
||||||
druid_azure_maxTries=3
|
druid_processing_numThreads=2
|
||||||
|
druid_processing_numMergeBuffers=2
|
||||||
|
|
||||||
DRUID_LOG4J=<?xml version="1.0" encoding="UTF-8" ?><Configuration status="WARN"><Appenders><Console name="Console" target="SYSTEM_OUT"><PatternLayout pattern="%d{ISO8601} %p [%t] %c - %m%n"/></Console></Appenders><Loggers><Root level="info"><AppenderRef ref="Console"/></Root><Logger name="org.apache.druid.jetty.RequestLog" additivity="false" level="DEBUG"><AppenderRef ref="Console"/></Logger></Loggers></Configuration>
|
DRUID_LOG4J=<?xml version="1.0" encoding="UTF-8" ?><Configuration status="WARN"><Appenders><Console name="Console" target="SYSTEM_OUT"><PatternLayout pattern="%d{ISO8601} %p [%t] %c - %m%n"/></Console></Appenders><Loggers><Root level="info"><AppenderRef ref="Console"/></Root><Logger name="org.apache.druid.jetty.RequestLog" additivity="false" level="DEBUG"><AppenderRef ref="Console"/></Logger></Loggers></Configuration>
|
||||||
|
|
|
@ -0,0 +1,80 @@
|
||||||
|
---
|
||||||
|
id: docker
|
||||||
|
title: "Docker"
|
||||||
|
---
|
||||||
|
|
||||||
|
<!--
|
||||||
|
~ Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
~ or more contributor license agreements. See the NOTICE file
|
||||||
|
~ distributed with this work for additional information
|
||||||
|
~ regarding copyright ownership. The ASF licenses this file
|
||||||
|
~ to you under the Apache License, Version 2.0 (the
|
||||||
|
~ "License"); you may not use this file except in compliance
|
||||||
|
~ with the License. You may obtain a copy of the License at
|
||||||
|
~
|
||||||
|
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
~
|
||||||
|
~ Unless required by applicable law or agreed to in writing,
|
||||||
|
~ software distributed under the License is distributed on an
|
||||||
|
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
~ KIND, either express or implied. See the License for the
|
||||||
|
~ specific language governing permissions and limitations
|
||||||
|
~ under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
In this quickstart, we will download the Apache Druid image from [Docker Hub](https://hub.docker.com/r/apache/druid) and set it up on a single machine using [Docker](https://www.docker.com/get-started) and [Docker Compose](https://docs.docker.com/compose/). 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](../design/index.md) and the [ingestion overview](../ingestion/index.md), as the tutorials will refer to concepts discussed on those pages. Additionally, familiarity with Docker is recommended.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
* Docker
|
||||||
|
|
||||||
|
## Getting started
|
||||||
|
|
||||||
|
The Druid source code contains [an example `docker-compose.yml`](https://github.com/apache/druid/blob/master/distribution/docker/docker-compose.yml) which can pull an image from Docker Hub and is suited to be used as an example environment and to experiment with Docker based Druid configuration and deployments.
|
||||||
|
|
||||||
|
### Compose file
|
||||||
|
|
||||||
|
The example `docker-compose.yml` will create a container for each Druid service, as well as Zookeeper and a PostgreSQL container as the metadata store. Deep storage will be a local directory, by default configured as `./storage` relative to your `docker-compose.yml` file, and will be mounted as `/opt/data` and shared between Druid containers which require access to deep storage. The Druid containers are configured via an [environment file](https://github.com/apache/druid/blob/master/distribution/docker/environment).
|
||||||
|
|
||||||
|
### Configuration
|
||||||
|
|
||||||
|
Configuration of the Druid Docker container is done via environment variables, which may additionally specify paths to [the standard Druid configuration files](../configuration/index.md)
|
||||||
|
|
||||||
|
Special environment variables:
|
||||||
|
|
||||||
|
* `JAVA_OPTS` -- set java options
|
||||||
|
* `DRUID_LOG4J` -- set the entire `log4j.xml` verbatim
|
||||||
|
* `DRUID_LOG_LEVEL` -- override the default log level in default log4j
|
||||||
|
* `DRUID_XMX` -- set Java `Xmx`
|
||||||
|
* `DRUID_XMS` -- set Java `Xms`
|
||||||
|
* `DRUID_MAXNEWSIZE` -- set Java max new size
|
||||||
|
* `DRUID_NEWSIZE` -- set Java new size
|
||||||
|
* `DRUID_MAXDIRECTMEMORYSIZE` -- set Java max direct memory size
|
||||||
|
* `DRUID_CONFIG_COMMON` -- full path to a file for druid 'common' properties
|
||||||
|
* `DRUID_CONFIG_${service}` -- full path to a file for druid 'service' properties
|
||||||
|
|
||||||
|
In addition to the special environment variables, the script which launches Druid in the container will also attempt to use any environment variable starting with the `druid_` prefix as a command-line configuration. For example, an environment variable
|
||||||
|
|
||||||
|
```druid_metadata_storage_type=postgresql```
|
||||||
|
|
||||||
|
would be translated into
|
||||||
|
|
||||||
|
```-Ddruid.metadata.storage.type=postgresql```
|
||||||
|
|
||||||
|
for the Druid process in the container.
|
||||||
|
|
||||||
|
The Druid `docker-compose.yml` example utilizes a single environment file to specify the complete Druid configuration; however, in production use cases we suggest using either `DRUID_COMMON_CONFIG` and `DRUID_CONFIG_${service}` or specially tailored, service-specific environment files.
|
||||||
|
## Launching the cluster
|
||||||
|
|
||||||
|
Run `docker-compose up` to launch the cluster with a shell attached, or `docker-compose up -d` to run the cluster in the background. If using the example files directly, this command should be run from `distribution/docker/` in your Druid installation directory.
|
||||||
|
|
||||||
|
Once the cluster has started, you can navigate to [http://localhost:8888](http://localhost:8888).
|
||||||
|
The [Druid router process](../design/router.md), which serves the [Druid console](../operations/druid-console.md), resides at this address.
|
||||||
|
|
||||||
|
![Druid console](../assets/tutorial-quickstart-01.png "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.
|
||||||
|
|
||||||
|
From here you can follow along with the [standard tutorials](./index.md#loading-data), or elaborate on your `docker-compose.yml` to add any additional external service dependencies as necessary.
|
|
@ -467,6 +467,9 @@
|
||||||
"tutorials/cluster": {
|
"tutorials/cluster": {
|
||||||
"title": "Clustered deployment"
|
"title": "Clustered deployment"
|
||||||
},
|
},
|
||||||
|
"tutorials/docker": {
|
||||||
|
"title": "Docker"
|
||||||
|
},
|
||||||
"tutorials/index": {
|
"tutorials/index": {
|
||||||
"title": "Quickstart"
|
"title": "Quickstart"
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
"Getting started": [
|
"Getting started": [
|
||||||
"design/index",
|
"design/index",
|
||||||
"tutorials/index",
|
"tutorials/index",
|
||||||
|
"tutorials/docker",
|
||||||
"operations/single-server",
|
"operations/single-server",
|
||||||
"tutorials/cluster"
|
"tutorials/cluster"
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in New Issue