You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by rx...@apache.org on 2020/07/29 09:18:44 UTC
[pulsar] 18/20: Use fully qualified hostname as default to
advertise worker. (#7360)
This is an automated email from the ASF dual-hosted git repository.
rxl pushed a commit to branch branch-2.6
in repository https://gitbox.apache.org/repos/asf/pulsar.git
commit b48120f59d50d2fef0a7551c1d7d74745e45453a
Author: Matteo Merli <mm...@apache.org>
AuthorDate: Thu Jun 25 20:29:06 2020 -0700
Use fully qualified hostname as default to advertise worker. (#7360)
### Motivation
Similar to #6235, we need to ensure to always use the fully qualified hostname
(cherry picked from commit bafb3732b9858c06023113d6662aabafc5910319)
---
.../src/main/java/org/apache/pulsar/functions/worker/WorkerConfig.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/worker/WorkerConfig.java b/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/worker/WorkerConfig.java
index c1280ca..bb8d896 100644
--- a/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/worker/WorkerConfig.java
+++ b/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/worker/WorkerConfig.java
@@ -493,7 +493,8 @@ public class WorkerConfig implements Serializable, PulsarConfiguration {
public static String unsafeLocalhostResolve() {
try {
- return InetAddress.getLocalHost().getHostName();
+ // Get the fully qualified hostname
+ return InetAddress.getLocalHost().getCanonicalHostName();
} catch (UnknownHostException ex) {
throw new IllegalStateException("Failed to resolve localhost name.", ex);
}