Cloudera recommends using DNS for hostname resolution. The usage of /etc/hosts becomes cumbersome quickly, and is routinely the source of hard-to-diagnose problems.
/etc/hosts should contain an entry for 127.0.0.1, and
localhostshould be the only name that resolves to it. The file should also contain an entry for the system’s IP address, FQDN, and shortname. The machine name must not resolve to the 127.0.0.1 address. All hosts in the cluster must have forward and reverse lookups to be the inverse of each other. An easy test to perform on the hosts to ensure proper DNS resolution is to run the following commands:
dig [***HOSTNAME***] dig –x [***IP-ADDRESS-RETURNED-FROM-HOSTNAME-LOOKUP***])
dig themis.apache.org themis.apache.org. 1758 IN A 220.127.116.11 dig -x 18.104.22.168 22.214.171.124.in-addr.arpa. 3513 IN PTR themis.apache.org.
This is the acceptable behavior for every host in the cluster.
Also, enable nscd with only hostname caching enabled for a 30-60 second period. This further reduces heavy DNS impact. This is a mitigation technique for preventing the overload of AD DNS, for example, which can fail over during high DNS load.
enable-cache passwd no enable-cache group no enable-cache hosts yes positive-time-to-live hosts 60 negative-time-to-live hosts 20