Skip to content

Commit

Permalink
involve KYUUBI_FRONTEND_BIND_HOST
Browse files Browse the repository at this point in the history
  • Loading branch information
turboFei committed Apr 9, 2021
1 parent 5eb7cdb commit e8b2372
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 24 deletions.
46 changes: 24 additions & 22 deletions conf/kyuubi-env.sh.template
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,30 @@
# limitations under the License.
#
#
# - JAVA_HOME Java runtime to use. By default use "java" from PATH.
#
#
# - KYUUBI_CONF_DIR Directory containing the Kyuubi configurations to use.
# (Default: $KYUUBI_HOME/conf)
# - KYUUBI_LOG_DIR Directory for Kyuubi server-side logs.
# (Default: $KYUUBI_HOME/logs)
# - KYUUBI_PID_DIR Directory stores the Kyuubi instance pid file.
# (Default: $KYUUBI_HOME/pid)
# - KYUUBI_MAX_LOG_FILES Maximum number of Kyuubi server logs can rotate to.
# (Default: 5)
# - KYUUBI_JAVA_OPTS JVM options for the Kyuubi server itself in the form "-Dx=y".
# (Default: none).
# - KYUUBI_NICENESS The scheduling priority for Kyuubi server.
# (Default: 0)
# - KYUUBI_WORK_DIR_ROOT Root directory for launching sql engine applications.
# (Default: $KYUUBI_HOME/work)
# - HADOOP_CONF_DIR Directory containing the Hadoop / YARN configuration to use.
#
# - SPARK_HOME Spark distribution which you would like to use in Kyuubi.
# - SPARK_CONF_DIR Optional directory where the Spark configuration lives.
# (Default: $SPARK_HOME/conf)
# - JAVA_HOME Java runtime to use. By default use "java" from PATH.
#
#
# - KYUUBI_CONF_DIR Directory containing the Kyuubi configurations to use.
# (Default: $KYUUBI_HOME/conf)
# - KYUUBI_LOG_DIR Directory for Kyuubi server-side logs.
# (Default: $KYUUBI_HOME/logs)
# - KYUUBI_PID_DIR Directory stores the Kyuubi instance pid file.
# (Default: $KYUUBI_HOME/pid)
# - KYUUBI_MAX_LOG_FILES Maximum number of Kyuubi server logs can rotate to.
# (Default: 5)
# - KYUUBI_JAVA_OPTS JVM options for the Kyuubi server itself in the form "-Dx=y".
# (Default: none).
# - KYUUBI_NICENESS The scheduling priority for Kyuubi server.
# (Default: 0)
# - KYUUBI_WORK_DIR_ROOT Root directory for launching sql engine applications.
# (Default: $KYUUBI_HOME/work)
# - HADOOP_CONF_DIR Directory containing the Hadoop / YARN configuration to use.
#
# - SPARK_HOME Spark distribution which you would like to use in Kyuubi.
# - SPARK_CONF_DIR Optional directory where the Spark configuration lives.
# (Default: $SPARK_HOME/conf)
#
# - KYUUBI_FRONTEND_BIND_HOST IP address for the frontend server to bind to.
#


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ class FrontendService private (name: String, be: BackendService, oomHook: Runnab
this.conf = conf
try {
hadoopConf = KyuubiHadoopUtils.newHadoopConf(conf)
val serverHost = conf.get(FRONTEND_BIND_HOST)
serverAddr = serverHost.map(InetAddress.getByName).getOrElse(InetAddress.getLocalHost)
serverAddr = findFrontendServerHost()
portNum = conf.get(FRONTEND_BIND_PORT)
val minThreads = conf.get(FRONTEND_MIN_WORKER_THREADS)
val maxThreads = conf.get(FRONTEND_MAX_WORKER_THREADS)
Expand Down Expand Up @@ -104,6 +103,15 @@ class FrontendService private (name: String, be: BackendService, oomHook: Runnab
super.initialize(conf)
}

private def findFrontendServerHost(): InetAddress = {
val serverHostOverride = System.getenv("KYUUBI_FRONTEND_BIND_HOST")
if (serverHostOverride != null) {
InetAddress.getByName(serverHostOverride)
} else {
conf.get(FRONTEND_BIND_HOST).map(InetAddress.getByName).getOrElse(InetAddress.getLocalHost)
}
}

def connectionUrl: String = {
getServiceState match {
case s @ ServiceState.LATENT => throw new IllegalStateException(s"Illegal Service State: $s")
Expand Down

0 comments on commit e8b2372

Please sign in to comment.