This is an automated email from the ASF dual-hosted git repository.
ngangam pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/master by this push:
new 149aaddcf45 HIVE-27147: HS2 is not accessible to clients via zookeeper
when hostname used is not FQDN (#4130)
149aaddcf45 is described below
commit 149aaddcf454c202369e4142ddcb107b029e4ea0
Author: Venu Reddy <[email protected]>
AuthorDate: Thu Mar 23 20:33:20 2023 +0530
HIVE-27147: HS2 is not accessible to clients via zookeeper when hostname
used is not FQDN (#4130)
Co-authored-by: Venu Reddy <[email protected]>
---
service/src/java/org/apache/hive/service/server/HiveServer2.java | 4 ++--
.../java/org/apache/hadoop/hive/metastore/conf/MetastoreConf.java | 2 +-
.../src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/service/src/java/org/apache/hive/service/server/HiveServer2.java
b/service/src/java/org/apache/hive/service/server/HiveServer2.java
index 59fe33eb3ba..a55cc20b9ed 100644
--- a/service/src/java/org/apache/hive/service/server/HiveServer2.java
+++ b/service/src/java/org/apache/hive/service/server/HiveServer2.java
@@ -663,7 +663,7 @@ public class HiveServer2 extends CompositeService {
if ((thriftCLIService == null) || (thriftCLIService.getServerIPAddress()
== null)) {
throw new Exception("Unable to get the server address; it hasn't been
initialized yet.");
}
- return thriftCLIService.getServerIPAddress().getHostName() + ":"
+ return thriftCLIService.getServerIPAddress().getCanonicalHostName() + ":"
+ thriftCLIService.getPortNumber();
}
@@ -671,7 +671,7 @@ public class HiveServer2 extends CompositeService {
if ((thriftCLIService == null) || (thriftCLIService.getServerIPAddress()
== null)) {
throw new Exception("Unable to get the server address; it hasn't been
initialized yet.");
}
- return thriftCLIService.getServerIPAddress().getHostName();
+ return thriftCLIService.getServerIPAddress().getCanonicalHostName();
}
@Override
diff --git
a/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/conf/MetastoreConf.java
b/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/conf/MetastoreConf.java
index f3f8be618ec..570f4f94dbe 100644
---
a/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/conf/MetastoreConf.java
+++
b/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/conf/MetastoreConf.java
@@ -559,7 +559,7 @@ public class MetastoreConf {
"means that the current metastore will run the housekeeping tasks. If
configuration" +
"metastore.thrift.bind.host is set on the intended leader metastore,
this value should " +
"match that configuration. Otherwise it should be same as the hostname
returned by " +
- "InetAddress#getLocalHost#getHostName(). Given the uncertainty in the
later " +
+ "InetAddress#getLocalHost#getCanonicalHostName(). Given the
uncertainty in the later " +
"it is desirable to configure metastore.thrift.bind.host on the
intended leader HMS."),
METASTORE_HOUSEKEEPING_LEADER_ELECTION("metastore.housekeeping.leader.election",
"metastore.housekeeping.leader.election",
diff --git
a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
index fd9afcae48f..bedce7bbde5 100644
---
a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
+++
b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
@@ -788,7 +788,7 @@ public class HiveMetaStore extends ThriftHiveMetastore {
if (msHost != null && !msHost.trim().isEmpty()) {
return msHost.trim();
} else {
- return InetAddress.getLocalHost().getHostName();
+ return InetAddress.getLocalHost().getCanonicalHostName();
}
}