Search code examples
javadockermesosapache-drilldcos

Drill JDBC and Zookeeper throws UnresolvedAddressException


Im trying to connect externally to a containerized distributed apache drill setup on DC/OS using the JDBC driver as shown here

https://drill.apache.org/docs/using-the-jdbc-driver/#example-of-connecting-to-drill-programmatically

However, when running this outside of the cluster to connect from my machine, the zookeeper connection completes, then it tries to resolve a Drillbit address in the form of

2d7f7217340c:31010

where 2d7f7217340c is the internal drillbit id as shown in the drill web console

which of course throws

java.nio.channels.UnresolvedAddressException

until I make an entry in my local /etc/hosts file to resolve 2d7f7217340c to the public ip of the drill node.

I've searched around quite a bit on the topic and not found anything. Is there a way to configure Zookeeper or Drill to return an IP rather than the drillbit ID so that the hosts file doesn't need to be manually updated?


Solution

  • I noticed that the address string 2d7f7217340c is defined by the container ID generated during deployment. Even with modifying the hostname of the container via

    lsns

    nsenter --target <container_pid> --uts hostname <public_ip>

    and restarting drill in the container, zookeeper still returns the 2d7f7217340c address.

    A working solution is to modify the recent addition of the DRILL_HOSTNAME variable in apache-drill/conf/drill-env.sh to grab the public hostname via the AWS metadata service

    export DRILL_HOSTNAME=`curl -s http://169.254.169.254/latest/meta-data/public-hostname`
    

    the public hostname is now advertised by Drill, and can be resolved both externally and internally