Package org.apache.hadoop.net
Class DNSDomainNameResolver
java.lang.Object
org.apache.hadoop.net.DNSDomainNameResolver
- All Implemented Interfaces:
DomainNameResolver
DNSDomainNameResolver wraps up the default DNS service for forward/reverse
DNS lookup. It also provides a function to resolve a host name to all of
fully qualified domain names belonging to the IPs from this host name
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAllByDomainName(String domainName) Takes one domain name and returns its IP addresses based on the actual service discovery methods.String[]getAllResolvedHostnameByDomainName(String domainName, boolean useFQDN) This function combines getAllByDomainName and getHostnameByIP, for a single domain name, it will first do a forward lookup to get all of IP addresses, then for each IP address, it will do a reverse lookup to get the fqdn.getHostnameByIP(InetAddress address) Reverse lookup an IP address and get the fully qualified domain name(fqdn).
-
Constructor Details
-
DNSDomainNameResolver
public DNSDomainNameResolver()
-
-
Method Details
-
getAllByDomainName
Description copied from interface:DomainNameResolverTakes one domain name and returns its IP addresses based on the actual service discovery methods.- Specified by:
getAllByDomainNamein interfaceDomainNameResolver- Parameters:
domainName- input domainName.- Returns:
- all IP addresses
- Throws:
UnknownHostException- indicate that the IP address of a host could not be determined.
-
getHostnameByIP
Description copied from interface:DomainNameResolverReverse lookup an IP address and get the fully qualified domain name(fqdn).- Specified by:
getHostnameByIPin interfaceDomainNameResolver- Parameters:
address- input address.- Returns:
- fully qualified domain name
-
getAllResolvedHostnameByDomainName
public String[] getAllResolvedHostnameByDomainName(String domainName, boolean useFQDN) throws UnknownHostException Description copied from interface:DomainNameResolverThis function combines getAllByDomainName and getHostnameByIP, for a single domain name, it will first do a forward lookup to get all of IP addresses, then for each IP address, it will do a reverse lookup to get the fqdn. This function is necessary in secure environment since Kerberos uses fqdn in the service principal instead of IP.- Specified by:
getAllResolvedHostnameByDomainNamein interfaceDomainNameResolver- Parameters:
domainName- input domainName.useFQDN- input useFQDN.- Returns:
- all fully qualified domain names belonging to the IPs resolved from the input domainName
- Throws:
UnknownHostException- indicate that the IP address of a host could not be determined.
-