Search code examples
apache-drill

How to start drillbit locally in distributed mode?


I downloaded Apache Drill v1.8, edited the conf/drill-override.conf to have the following changes:

drill.exec: {
  cluster-id: "drillbits1",
  zk.connect: "10.178.23.140:2181,10.178.23.140:2182,10.178.23.140:2183,10.178.23.140:2184"
}

..zookeeper cluster is effectively consisted of 4 Zookeeper instances started on the same, one machine, I'm trying to start Drill on. (i.e. I'm only using one machine for Apache Drill and Zookeeper's cluster, the machine's IP is 10.178.23.140)

So I keep getting this error:

Exception in thread "main" org.apache.drill.exec.exception.DrillbitStartupException: Failure during initial startup of Drillbit.
    at org.apache.drill.exec.server.Drillbit.start(Drillbit.java:295)
    at org.apache.drill.exec.server.Drillbit.start(Drillbit.java:271)
    at org.apache.drill.exec.server.Drillbit.main(Drillbit.java:267)
Caused by: org.apache.drill.exec.exception.DrillbitStartupException: Drillbit is disallowed to bind to loopback address in distributed mode.
    at org.apache.drill.exec.service.ServiceEngine.checkLoopbackAddress(ServiceEngine.java:186)
    at org.apache.drill.exec.service.ServiceEngine.start(ServiceEngine.java:146)
    at org.apache.drill.exec.server.Drillbit.run(Drillbit.java:119)
    at org.apache.drill.exec.server.Drillbit.start(Drillbit.java:291)
    ... 2 more

Why does drillbit complain about being bound to a loopback address ?!

  1. I didn't configure an IP for drillbit to bind to !
  2. And since I'm starting drillbit process on my machine, what other IP that my machine would it be try to bind to ?!

Solution

  • The problem was that my /etc/hosts file had this entry

    127.0.1.1   mgelbana-machine
    

    This made my hostname resolvable to a loopback address. To resolve this, you can do either of the following

    • Removing this line resolved my problem.
    • Having my hostname resolved to a non-loopback IP address.

    Source

    private void checkLoopbackAddress(String address) throws DrillbitStartupException, UnknownHostException {
      if (isDistributedMode && InetAddress.getByName(address).isLoopbackAddress()) {
        throw new DrillbitStartupException("Drillbit is disallowed to bind to loopback address in distributed mode.");
      }
    }
    

    The reason why Drill refuses to startup while bound to a loopback address, is to differentiate between Drill nodes registered in Zookeeper.