You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ta...@apache.org on 2019/05/29 15:34:17 UTC
[impala] branch master updated: IMPALA-8546: collect logs from
docker containers
This is an automated email from the ASF dual-hosted git repository.
tarmstrong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git
The following commit(s) were added to refs/heads/master by this push:
new 7ea9a94 IMPALA-8546: collect logs from docker containers
7ea9a94 is described below
commit 7ea9a949259a7ab600eb9d7de888d22ef4ecd6b9
Author: Tim Armstrong <ta...@cloudera.com>
AuthorDate: Tue May 21 10:49:16 2019 -0700
IMPALA-8546: collect logs from docker containers
This modifies containers to put logs in /opt/impala/logs,
then mounts that directory to
$IMPALA_HOME/logs/.../<container_name> so that logs will
be collected on the host and scooped up by jenkins jobs.
The layout of the log directory is a little different to
the non-dockerised containers because I wanted to avoid
sharing log directories between containers.
Change-Id: I24bcaa521882d450d43d1f2ca34767e7ce36bbd2
Reviewed-on: http://gerrit.cloudera.org:8080/13393
Reviewed-by: Tim Armstrong <ta...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
bin/start-impala-cluster.py | 7 +++++++
docker/catalogd/Dockerfile | 1 +
docker/coord_exec/Dockerfile | 1 +
docker/coordinator/Dockerfile | 1 +
docker/daemon_entrypoint.sh | 5 +++++
docker/executor/Dockerfile | 1 +
docker/impala_base/Dockerfile | 2 ++
docker/statestored/Dockerfile | 3 ++-
8 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/bin/start-impala-cluster.py b/bin/start-impala-cluster.py
index 2ac46b1..5849ed6 100755
--- a/bin/start-impala-cluster.py
+++ b/bin/start-impala-cluster.py
@@ -557,6 +557,13 @@ class DockerMiniClusterOperations(object):
conf_dir = os.path.join(IMPALA_HOME, "fe/src/test/resources/")
mount_args = ["--mount", "type=bind,src={0},dst=/opt/impala/conf".format(conf_dir)]
+ # Collect container logs in a unique subdirectory per daemon to avoid any potential
+ # interaction between containers, which should be isolated.
+ log_dir = os.path.join(IMPALA_HOME, options.log_dir, host_name)
+ if not os.path.isdir(log_dir):
+ os.makedirs(log_dir)
+ mount_args += ["--mount", "type=bind,src={0},dst=/opt/impala/logs".format(log_dir)]
+
# Allow loading LZO plugin, if built.
lzo_lib_dir = os.path.join(IMPALA_LZO, "build")
if os.path.isdir(lzo_lib_dir):
diff --git a/docker/catalogd/Dockerfile b/docker/catalogd/Dockerfile
index b4d32b8..11a7ed7 100644
--- a/docker/catalogd/Dockerfile
+++ b/docker/catalogd/Dockerfile
@@ -22,6 +22,7 @@ FROM impala_base
EXPOSE 25020
ENTRYPOINT ["/opt/impala/bin/daemon_entrypoint.sh", "/opt/impala/bin/catalogd",\
+ "-log_dir=/opt/impala/logs",\
"-abort_on_config_error=false", "-state_store_host=statestored",\
"-catalog_topic_mode=minimal", "-hms_event_polling_interval_s=1",\
"-invalidate_tables_on_memory_pressure=true"]
diff --git a/docker/coord_exec/Dockerfile b/docker/coord_exec/Dockerfile
index 11356bc..d70e251 100644
--- a/docker/coord_exec/Dockerfile
+++ b/docker/coord_exec/Dockerfile
@@ -26,6 +26,7 @@ EXPOSE 21050
EXPOSE 25000
ENTRYPOINT ["/opt/impala/bin/daemon_entrypoint.sh", "/opt/impala/bin/impalad",\
+ "-log_dir=/opt/impala/logs",\
"-abort_on_config_error=false", "-state_store_host=statestored",\
"-catalog_service_host=catalogd", "-mem_limit_includes_jvm=true",\
"-use_local_catalog=true"]
diff --git a/docker/coordinator/Dockerfile b/docker/coordinator/Dockerfile
index cf86f2e..2888fb5 100644
--- a/docker/coordinator/Dockerfile
+++ b/docker/coordinator/Dockerfile
@@ -26,6 +26,7 @@ EXPOSE 21050
EXPOSE 25000
ENTRYPOINT ["/opt/impala/bin/daemon_entrypoint.sh", "/opt/impala/bin/impalad",\
+ "-log_dir=/opt/impala/logs",\
"-abort_on_config_error=false", "-state_store_host=statestored",\
"-catalog_service_host=catalogd", "-is_executor=false", \
"-mem_limit_includes_jvm=true", "-use_local_catalog=true"]
diff --git a/docker/daemon_entrypoint.sh b/docker/daemon_entrypoint.sh
index b6b4ed7..d3b7a18 100755
--- a/docker/daemon_entrypoint.sh
+++ b/docker/daemon_entrypoint.sh
@@ -47,6 +47,11 @@ echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH"
# Default to 2GB heap. Allow overriding by externally-set JAVA_TOOL_OPTIONS.
export JAVA_TOOL_OPTIONS="-Xmx2g $JAVA_TOOL_OPTIONS"
+# Allow any files written by the container to be modified by other users.
+# This is required when mounting the log directory to a host directory.
+# TODO: IMPALA-8491: once running as non-root user, this may not be needed.
+umask 000
+
"$@"
EXIT_CODE=$?
diff --git a/docker/executor/Dockerfile b/docker/executor/Dockerfile
index 6741203..5d03bc6 100644
--- a/docker/executor/Dockerfile
+++ b/docker/executor/Dockerfile
@@ -22,6 +22,7 @@ FROM impala_base
EXPOSE 25000
ENTRYPOINT ["/opt/impala/bin/daemon_entrypoint.sh", "/opt/impala/bin/impalad",\
+ "-log_dir=/opt/impala/logs",\
"-abort_on_config_error=false", "-state_store_host=statestored",\
"-catalog_service_host=catalogd", "-is_coordinator=false",\
"-mem_limit_includes_jvm=true"]
diff --git a/docker/impala_base/Dockerfile b/docker/impala_base/Dockerfile
index bd6eae8..fbbb562 100644
--- a/docker/impala_base/Dockerfile
+++ b/docker/impala_base/Dockerfile
@@ -33,5 +33,7 @@ COPY www /opt/impala/www
COPY kudu /opt/kudu
# Create conf directory for later config injection.
RUN mkdir /opt/impala/conf
+# Create logs directory to collect container logs.
+RUN mkdir /opt/impala/logs
WORKDIR /opt/impala/
diff --git a/docker/statestored/Dockerfile b/docker/statestored/Dockerfile
index b29cb22..8149457 100644
--- a/docker/statestored/Dockerfile
+++ b/docker/statestored/Dockerfile
@@ -21,4 +21,5 @@ FROM impala_base
# Debug webserver
EXPOSE 25010
-ENTRYPOINT ["/opt/impala/bin/daemon_entrypoint.sh", "/opt/impala/bin/statestored"]
+ENTRYPOINT ["/opt/impala/bin/daemon_entrypoint.sh", "/opt/impala/bin/statestored",\
+ "-log_dir=/opt/impala/logs"]