diff --git a/distribution/docker/Dockerfile b/distribution/docker/Dockerfile index 06d55dee693..7e7cdcb632c 100644 --- a/distribution/docker/Dockerfile +++ b/distribution/docker/Dockerfile @@ -41,7 +41,7 @@ RUN VERSION=$(mvn -B -q org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluat -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 + && mv /opt/apache-druid-${VERSION} /opt/druid FROM amd64/busybox:1.30.0-glibc as busybox @@ -56,9 +56,13 @@ RUN addgroup -S -g 1000 druid \ COPY --chown=druid:druid --from=builder /opt /opt COPY distribution/docker/druid.sh /druid.sh -RUN mkdir /opt/druid/var \ - && chown druid:druid /opt/druid/var \ - && chmod 775 /opt/druid/var + +# create necessary directories which could be mounted as volume +# /opt/druid/var is used to keep individual files(e.g. log) of each Druid service +# /opt/shared is used to keep segments and task logs shared among Druid services +RUN mkdir /opt/druid/var /opt/shared \ + && chown druid:druid /opt/druid/var /opt/shared \ + && chmod 775 /opt/druid/var /opt/shared USER druid VOLUME /opt/druid/var diff --git a/distribution/docker/docker-compose.yml b/distribution/docker/docker-compose.yml index a940f4af66e..ed4dbef4c06 100644 --- a/distribution/docker/docker-compose.yml +++ b/distribution/docker/docker-compose.yml @@ -25,6 +25,7 @@ volumes: broker_var: {} coordinator_var: {} router_var: {} + druid_shared: {} services: @@ -51,7 +52,7 @@ services: image: apache/druid:0.22.0 container_name: coordinator volumes: - - ./storage:/opt/data + - druid_shared:/opt/shared - coordinator_var:/opt/druid/var depends_on: - zookeeper @@ -83,7 +84,7 @@ services: image: apache/druid:0.22.0 container_name: historical volumes: - - ./storage:/opt/data + - druid_shared:/opt/shared - historical_var:/opt/druid/var depends_on: - zookeeper @@ -100,7 +101,7 @@ services: image: apache/druid:0.22.0 container_name: middlemanager volumes: - - ./storage:/opt/data + - druid_shared:/opt/shared - middle_var:/opt/druid/var depends_on: - zookeeper diff --git a/distribution/docker/environment b/distribution/docker/environment index 2023138b20e..7bb9214a701 100644 --- a/distribution/docker/environment +++ b/distribution/docker/environment @@ -39,12 +39,12 @@ druid_metadata_storage_connector_password=FoolishPassword 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_fork_property_druid_processing_buffer_sizeBytes=268435456 +druid_indexer_fork_property_druid_processing_buffer_sizeBytes=256MiB druid_storage_type=local -druid_storage_storageDirectory=/opt/data/segments +druid_storage_storageDirectory=/opt/shared/segments druid_indexer_logs_type=file -druid_indexer_logs_directory=/opt/data/indexing-logs +druid_indexer_logs_directory=/opt/shared/indexing-logs druid_processing_numThreads=2 druid_processing_numMergeBuffers=2 diff --git a/docs/tutorials/docker.md b/docs/tutorials/docker.md index 33dc8e73585..b64b636b995 100644 --- a/docs/tutorials/docker.md +++ b/docs/tutorials/docker.md @@ -36,7 +36,11 @@ The Druid source code contains [an example `docker-compose.yml`](https://github. ### 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/{{DRUIDVERSION}}/distribution/docker/environment). +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. + +It will also create a named volumes `druid_shared`, which is mounted as `opt/shared` in container, as deep storage to keep and share segments and task logs among Druid services. + +The Druid containers are configured via an [environment file](https://github.com/apache/druid/blob/{{DRUIDVERSION}}/distribution/docker/environment). ### Configuration