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
This commit is contained in:
frank chen 2021-06-02 08:33:27 +08:00 committed by GitHub
parent 27f1b6cbf3
commit d5139c9543
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 11 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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