Hadoop: java.net.UnknownHostException: hadoop-slave-2 Hadoop: java.net.UnknownHostException: hadoop-slave-2 hadoop hadoop

Hadoop: java.net.UnknownHostException: hadoop-slave-2


The issue lies in the /etc/hosts file of the slaves. The reason there were no errors while putting file and formatting namenode is that the master communicates to all the slaves and it has ip addresses for all of them. But once you run an application on the cluster, the Application master is created on one of the slaves. AM then through slave has to communicate with other slaves. Since slave’s host file does not have their address (judging by the posted hosts file for slaves) it is giving an Unknown host error.

As rule of thumb, make sure all the nodes in the cluster have ip addresses to every other node in the cluster. Fix this and the error should go away.


UnknownHostException error while running Hadoop application

Tested on hadoop 2.7.7. Created 4 ubuntu VMs on Ubuntu host.1 VM as namenode3 VMs as datanodes.

UnknownHostexception got removed when /etc/hosts table updated with the ip addresses of all the nodes.

Example:192.168.2.7 namenode 192.168.2.11 datanode1192.168.2.12 datanode2192.168.2.13 datanode3