Description
When users add a remote TransportAddress
to a client not using sniffing (default), we currently first establish a temporary connection to it. Using this temporary connection, we retrieve the remote node info via the TransportLivenessAction
. We use the remove node info to validate the cluster name but also construct a new DiscoveryNode
object that is identical to the one supplied by the remote node with the exception of the TransportAddress
. The address of the constructed DiscoveryNode
is set to the same TransportAddress
the user supplied. The temporary connection is then closed and the newly constructed DiscoveryNode
is use to open a full persisted connection using TransportService.connectToNode
.
Sadly, this flow cause problems with load balancer. If the supplied address points at a load balancer, the second persistent connection can be routed to a different node than the one the temporary connection was opened to. In that case, the DiscoveryNode
we got contains different information then the node that accepted persistent connection. In that case, the extra handshaking in the TransportService
added in 5.4 fails and the added address is rejected.
While the extra validation is important for connections between nodes in the cluster, it is too strict for the transport client and we can relax it in that use case.
Note that this not relevant if sniffing is enabled. In that case, we can't support a load balancer as we don't know what the right IP should be for the nodes we sniffed.