From 4018d0bc2da05f2de6073c368b30db35854897cf Mon Sep 17 00:00:00 2001 From: Matteo Merli Date: Thu, 6 Feb 2020 17:23:03 -0800 Subject: [PATCH] Use fully qualified hostname as default to advertise brokers (#6235) --- .../org/apache/pulsar/broker/ServiceConfigurationUtils.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfigurationUtils.java b/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfigurationUtils.java index 9f79b53bdff0b..447b86207f02a 100644 --- a/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfigurationUtils.java +++ b/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfigurationUtils.java @@ -39,7 +39,8 @@ public static String getDefaultOrConfiguredAddress(String configuredAddress) { public static String unsafeLocalhostResolve() { try { - return InetAddress.getLocalHost().getHostName(); + // Get the fully qualified hostname + return InetAddress.getLocalHost().getCanonicalHostName(); } catch (UnknownHostException ex) { LOG.error(ex.getMessage(), ex); throw new IllegalStateException("Failed to resolve localhost name.", ex);