In kafka-client 2.1.0, client.dns.lookup is available. Below is a description of each option.
use_all_dns_ips
when the lookup returns multiple IP addresses for a hostname, they will all be attempted to connect to before failing the connection
resolve_canonical_bootstrap_servers_only
each entry will be resolved and expanded into a list of canonical names
Aren't they both using dns? What are the differences between use_all_dns_ips and resolve_canonical_bootstrap_servers_only ?
While both these options are about DNS, they are different:
use_all_dns_ips
: When resolving broker hostnames, if multiple IPs are returned for a name, the client will store them all and cycle through all IPs if it gets disconnected.
More details in the KIP: https://cwiki.apache.org/confluence/display/KAFKA/KIP-302+-+Enable+Kafka+clients+to+use+all+DNS+resolved+IP+addresses
resolve_canonical_bootstrap_servers_only
: When enabled, once a hostname has been resolved, the client is do a reverse lookup to find the FQDN. This can be required in some cases when using SASL GSSAPI.
More details in the KIP: https://cwiki.apache.org/confluence/display/KAFKA/KIP-235%3A+Add+DNS+alias+support+for+secured+connection