Status
Current state: "Under Discussion"
Discussion thread: here [Change the link from the KIP proposal email archive to your own email thread]
JIRA: KAFKA-6863
Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).
co-authored-by: Mickael Maison <mickael.maison@gmail.com>
Motivation
Currently the Kafka clients resolve a symbolic hostname (in org.apache.kafka.clients.NetworkClient.initiateConnect()
)using
new InetSocketAddress(String hostname, int port)
which only picks one IP address even if the DNS has multiple records for the hostname, as it calls
InetAddress.getAllByName(host)[0]
For some environments where the broker hostnames are mapped by the DNS to multiple IPs, e.g. in clouds where the IPs point to the external load balancers, it is desirable that the client, on failing to connect to one of the IPs, would try the other ones before giving up the connection.
Public Interfaces
Client configuration
Introduce a new configuration parameter :
use.all.dns.ips = true / false
The default value for this parameter is false, there will be no backwards compatibility issue.
Setting the parameter to true will have the client try to connect to all resolved IPs.
Proposed Changes
If the configuration parameter use.all.dns.ips is set to true, the network client code will use
InetAddress.getAllByName
to find all IPs and iterates over them when they fail to connect, until they are exhausted
Compatibility, Deprecation, and Migration Plan
- What impact (if any) will there be on existing users?
- None with the default configuration
Rejected Alternatives
Making the client use all IPs by default