1
votes

I'm learning hadoop and try to set up the environment according to online documents. I've configured the ssh (that ssh localhost won't need a password), configured the "core-site.xml", "hdfs-site.xml", "mapred-site.xml" and "yarn-site.xml" But when I tried "hadoop namenode -format" it gave out "java.net.UnknownHostException" and host = java.net.UnknownHostException:

I've tried to search online help but nearly all are: change the network configuration in etc/hosts. But I'm using hadoop 2.4 and there's no such folder.

Any suggestion?

Thanks!

2

2 Answers

0
votes

Well, they are right, you have to change the /etc/hosts file. I assume you have localhost on your hadoop configuration files, so you need to open /etc/hosts as sudo and add the following line:

127.0.0.1 localhost localhost
0
votes

I found solution which worked for me.

First of all edit your /etc/hostname, write namenode or alias you want to set for namenode then run sudo ifconfig eth0 down&&sudo ifconfig eth0 up and try again.