Friday, February 8, 2013

Hadoop and FQDN

I was mucking around with Hadoop today, trying to get a few more nodes up and running. The tricky bit about deploying new nodes is the setting up of the node names, the ip addresses, and the sharing of the ssh keys.

I wrote a nice script that would deploy all the information I needed onto each server in one go. This allows me to quickly send commands, copy files, etc without using passwords. Its great for managing servers.

Anyway, the trouble I had today was trying to figure out why every single one of my task trackers were called localhost. Every single task tracker that my job tracker was managing; every data node that my name node was managing; were all called localhost.

This drove me crazy; try as I might I couldn't figure it out. I searched the web for answers; and finally found it. Apparently Hadoop uses the Fully Qualified Domain Name of the host. If you run hostname -f (or hostname -fqdn for those pedantic guys) you get the name of the host. And this is what Hadoop Task Tracker uses when it starts up.

The tricky thing is that in most cases this was localhost because of the way the /etc/hosts file was set up. 127.0.0.1 always mapped to localhost first (in my config anyway) so when it started it used that first. So the simple fix is to move localhost in the /etc/hosts file to the end and it worked!

Here is a reference of the post I found online that explained it.

No comments:

Post a Comment