This is an automated email from the ASF dual-hosted git repository. dbecker pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/impala.git
commit 26b7116c3bb296615d297af518f29bddcb2b2bd9 Author: Laszlo Gaal <[email protected]> AuthorDate: Mon Nov 25 08:58:55 2024 -0800 IMPALA-13724: Add hostnames for Docker host and gateway to Impala containers Reverse DNS lookup for the Docker container's internal gateway (routing traffic between code running inside the container and code runnning natively on the Docker host) happens differently on various operating systems. Some recent platforms, like RHEL 9 resolve this address to the default name _gateway. Unfortunately the Java Thrift library within Impala's frontend considers the underscore character invalid in DNS names, so it throws an error, preventing the Impala coordinator from connecting to HMS. This kills Impala on startup, blocking any testing efforts inside containers. To avoid this problem this patch adds explicit entries to the container's /etc/hosts file for the gateway's address as well as the Docker host network. The name doesn't really matter, as it is used only for Thrift's logging code, so the mapping uses constant generic name 'gateway'. The IP address of the gateway is retrieved from the environment variable INTERNAL_LISTEN_HOST, which is set up by docker/configure_test_network.sh before the Impala containers are launched. Tested by a dockerised test run executed on Rocky Linux 9.2, using Rocky 9.2 Docker base images for the Impala containers. Change-Id: I545607c0bb32f8043a0d3f6045710f28a47bab99 Reviewed-on: http://gerrit.cloudera.org:8080/22438 Reviewed-by: Impala Public Jenkins <[email protected]> Tested-by: Impala Public Jenkins <[email protected]> --- bin/start-impala-cluster.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/bin/start-impala-cluster.py b/bin/start-impala-cluster.py index 9f56eeeb2..725525d5b 100755 --- a/bin/start-impala-cluster.py +++ b/bin/start-impala-cluster.py @@ -1003,13 +1003,25 @@ class DockerMiniClusterOperations(object): # for config changes to take effect. 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)] + # Add entries to the container's /etc/hosts file for the Docker host and the + # gateway from the container to the host. These are needed for stable reverse + # name resolution of the host's and the gateway's IP addresses + # The local host's name is governed by convention, see + # https://docs.docker.com/reference/cli/docker/container/run/#add-host + local_host_arg = ["--add-host=host.docker.internal:host-gateway"] + # For a dockerised setup INTERNAL_LISTEN_HOST stores the Docker gateway's IP address, + # prepared by docker/configure_test_network.sh. If it contains "localhost", then + # setup is not complete, so don't add it; it would be invalid as an IP address + # anyway. + local_gateway_arg = None + if INTERNAL_LISTEN_HOST != "localhost": + local_gateway_arg = ["--add-host=gateway.internal:{0}".format(INTERNAL_LISTEN_HOST)] # Create a data cache subdirectory for each daemon and mount at /opt/impala/cache # in the container. @@ -1028,8 +1040,9 @@ class DockerMiniClusterOperations(object): mem_limit_args = ["--memory", str(mem_limit)] LOG.info("Running container {0}".format(container_name)) run_cmd = (["docker", "run", "-d"] + env_args + port_args + user_args + ["--network", - self.network_name, "--name", container_name, "--network-alias", host_name] + - mount_args + mem_limit_args + [image_tag] + args) + self.network_name, "--name", container_name, "--network-alias", host_name] + + local_host_arg + local_gateway_arg + + mount_args + mem_limit_args + [image_tag] + args) LOG.info("Running command {0}".format(run_cmd)) check_call(run_cmd) port_mapping = check_output(["docker", "port", container_name],
