drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From par...@apache.org
Subject [1/5] drill git commit: DRILL-4935: Allow drillbits to advertise a configurable host address to Zookeeper
Date Wed, 23 Nov 2016 23:42:09 GMT
Repository: drill
Updated Branches:
  refs/heads/master 35275536c -> 04fb0be19


DRILL-4935: Allow drillbits to advertise a configurable host address to
Zookeeper

This closes #647


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/1c231735
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/1c231735
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/1c231735

Branch: refs/heads/master
Commit: 1c23173549ee53481316c85a65028f6ff9fb1b93
Parents: 3527553
Author: Harrison Mebane <harrison@svds.com>
Authored: Fri Oct 7 13:10:36 2016 -0700
Committer: Parth Chandra <parthc@apache.org>
Committed: Mon Nov 21 17:32:09 2016 -0800

----------------------------------------------------------------------
 distribution/src/resources/drill-env.sh                  |  4 ++++
 .../org/apache/drill/exec/service/ServiceEngine.java     | 11 ++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/1c231735/distribution/src/resources/drill-env.sh
----------------------------------------------------------------------
diff --git a/distribution/src/resources/drill-env.sh b/distribution/src/resources/drill-env.sh
index 89a0c1e..cd11b47 100644
--- a/distribution/src/resources/drill-env.sh
+++ b/distribution/src/resources/drill-env.sh
@@ -62,6 +62,10 @@
 
 #export DRILLBIT_CODE_CACHE_SIZE=${DRILLBIT_CODE_CACHE_SIZE:-"1G"}
 
+# Provide a customized host name for when the default mechanism is not accurate
+
+#export DRILL_HOST_NAME=`hostname`
+
 # Base name for Drill log files. Files are named ${DRILL_LOG_NAME}.out, etc.
 
 # DRILL_LOG_NAME="drillbit"

http://git-wip-us.apache.org/repos/asf/drill/blob/1c231735/exec/java-exec/src/main/java/org/apache/drill/exec/service/ServiceEngine.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/service/ServiceEngine.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/service/ServiceEngine.java
index d505546..9b7b6c7 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/service/ServiceEngine.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/service/ServiceEngine.java
@@ -140,9 +140,18 @@ public class ServiceEngine implements AutoCloseable {
         name, context.getConfig().getLong(initReservation), context.getConfig().getLong(maxAllocation));
   }
 
+  private String getHostName() throws UnknownHostException{
+    // DRILL_HOST_NAME sets custom host name.  See drill-env.sh for details.
+    String customHost = System.getenv("DRILL_HOST_NAME");
+    if (customHost != null) {
+      return customHost;
+    }
+    return useIP ? InetAddress.getLocalHost().getHostAddress() : InetAddress.getLocalHost().getCanonicalHostName();
+  }
+
   public DrillbitEndpoint start() throws DrillbitStartupException, UnknownHostException{
     int userPort = userServer.bind(config.getInt(ExecConstants.INITIAL_USER_PORT), allowPortHunting);
-    String address = useIP ?  InetAddress.getLocalHost().getHostAddress() : InetAddress.getLocalHost().getCanonicalHostName();
+    String address = getHostName();
     checkLoopbackAddress(address);
 
     DrillbitEndpoint partialEndpoint = DrillbitEndpoint.newBuilder()


Mime
View raw message