Github user markap14 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/688#discussion_r72613879
  
    --- Diff: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/heartbeat/ClusterProtocolHeartbeatMonitor.java
 ---
    @@ -91,12 +91,8 @@ public ClusterProtocolHeartbeatMonitor(final 
ClusterCoordinator clusterCoordinat
             this.clusterNodesPath = 
zkClientConfig.resolvePath("cluster/nodes");
     
             String hostname = 
properties.getProperty(NiFiProperties.CLUSTER_NODE_ADDRESS);
    -        if (hostname == null) {
    -            try {
    -                hostname = InetAddress.getLocalHost().getHostName();
    -            } catch (UnknownHostException e) {
    -                throw new RuntimeException("Unable to determine local 
hostname and the '" + NiFiProperties.CLUSTER_NODE_ADDRESS + "' property is not 
set");
    -            }
    +        if (hostname == null || hostname.trim().isEmpty()) {
    +            hostname = "localhost";
    --- End diff --
    
    @ijokarumawak the reason that I explicitly changed it to 'localhost' is 
because this is what the documentation says will be used. This is how it was 
done in 0.x, as well. I think the reason for this is that we want to urge 
admins to configure it, because getLocalHost().getHostName() may not 
necessarily return the correct result if there are multiple network interfaces, 
which is quite common in production systems. For example, the hostname on a 
private network may be nifi-01 while the hostname on the public lan will be 
r00s80-hq.mycompany.com. So getLocalHost() i believe will return whatever the 
'hostname' command returns (in linux at least). But there's a good chance that 
we want to use the private LAN for cluster comms. So this just sort of urges 
the admin to configure it... at least, I think that's why the decision was made 
to use "localhost." Not sure since I didn't make the decision :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to