You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by cw...@apache.org on 2021/06/02 00:33:57 UTC

[druid] branch master updated: Fix permission problems in docker (#11299)

This is an automated email from the ASF dual-hosted git repository.

cwylie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git


The following commit(s) were added to refs/heads/master by this push:
     new d5139c9  Fix permission problems in docker (#11299)
d5139c9 is described below

commit d5139c9543b1e7d51e78312044e329f2a3ecb070
Author: frank chen <fr...@outlook.com>
AuthorDate: Wed Jun 2 08:33:27 2021 +0800

    Fix permission problems in docker (#11299)
    
    * Create /opt/data to fix permission problem
    
    * eliminate symlink to avoid compatibility problem on AWS Fargate
    
    * Add a workaround section
    
    * Update instruction for named volume
    
    * Use named volume in docker-compose
    
    * Revert some doc change
    
    * Resolve review comments
---
 distribution/docker/Dockerfile         | 12 ++++++++----
 distribution/docker/docker-compose.yml |  7 ++++---
 distribution/docker/environment        |  6 +++---
 docs/tutorials/docker.md               |  6 +++++-
 4 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/distribution/docker/Dockerfile b/distribution/docker/Dockerfile
index 06d55de..7e7cdcb 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 a940f4a..ed4dbef 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 2023138..7bb9214 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 33dc8e7..b64b636 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/{{DRUIDVERS [...]
+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
 

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org