Here is the code in which it NodeManagercreates NodeId:
private NodeId buildNodeId(InetSocketAddress connectAddress,
String hostOverride) {
if (hostOverride != null) {
connectAddress = NetUtils.getConnectAddress(
new InetSocketAddress(hostOverride, connectAddress.getPort()));
}
return NodeId.newInstance(
connectAddress.getAddress().getCanonicalHostName(),
connectAddress.getPort());
}
NodeManagertrying to get the canonical host name from the binding address, localhostwill be obtained at the specified address 127.0.0.1.
, localhost.localdomain 127.0.0.1, /etc/hosts :
127.0.0.1 slave1 localhost.localdomain localhost
127.0.0.1 slave2 localhost.localdomain localhost