Exception description
In the case of an unknown hostname when you format the Hadoop namenode-format command on HDFS, the exception information is as follows:
Java code
- [Shirdrn@localhost bin]$ Hadoop namenode-format
- 11/06/: + INFO namenode. Namenode:startup_msg:
- /************************************************************
- Startup_msg:starting NameNode
- Startup_msg: <span style= "Color:rgb (255, 0, 0); >host = Java.net.UnknownHostException:centos64:centos64
- </span>startup_msg:args = [-format]
- Startup_msg:version = 0.20.0
- Startup_msg:build = Https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.20-r 763504; Compiled by ' Ndaley ' on Thu Apr 9 05:18:40 UTC 2009
- ************************************************************/
- Re-format filesystem In/tmp/hadoop/hadoop-shirdrn/dfs/name? (Y or N) Y
- 11/06/: £ º $INFO Namenode. Fsnamesystem:fsowner=shirdrn,shirdrn
- 11/06/: £ º $INFO Namenode. Fsnamesystem:supergroup=supergroup
- 11/06/: £ º $INFO Namenode. Fsnamesystem:ispermissionenabled=true
- 11/06/: £ º $INFO metrics. Metricsutil:unable to obtain HostName
- Java.net.UnknownHostException: <span style="Color:rgb (255, 0, 0); >localhost.localdomain:localhost.localdomain
- </span> at Java.net.InetAddress.getLocalHost (Inetaddress.java:1353)
- At Org.apache.hadoop.metrics.MetricsUtil.getHostName (Metricsutil.java:)
- At Org.apache.hadoop.metrics.MetricsUtil.createRecord (Metricsutil.java:)
- At Org.apache.hadoop.hdfs.server.namenode.FSDirectory.initialize (Fsdirectory.java:)
- At Org.apache.hadoop.hdfs.server.namenode.fsdirectory.<init> (Fsdirectory.java:)
- At Org.apache.hadoop.hdfs.server.namenode.fsnamesystem.<init> (Fsnamesystem.java:370)
- At Org.apache.hadoop.hdfs.server.namenode.NameNode.format (Namenode.java:853)
- At Org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode (Namenode.java:947)
- At Org.apache.hadoop.hdfs.server.namenode.NameNode.main (Namenode.java:964)
- 11/06/: £ º $INFO common. Storage:image file of size saved in 0 seconds.
- 11/06/: £ º $INFO common. Storage:storage Directory/tmp/hadoop/hadoop-shirdrn/dfs/name has been successfully formatted.
- 11/06/: £ º $INFO Namenode. Namenode:shutdown_msg:
- /************************************************************
- Shutdown_msg:shutting down NameNode at Java.net.UnknownHostException:localhost.localdomain:localhost.localdomain
- ************************************************************/
[[email protected] bin]$ Hadoop namenode-format11/06/22 07:33:31 INFO namenode. Namenode:startup_msg:/************************************************************startup_msg:starting Namenodestartup_msg:host = Java.net.UnknownHostException:centos64:centos64STARTUP_MSG:args = [-format]startup_msg: Version = 0.20.0startup_msg:build = Https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.20-r 763504; Compiled by ' Ndaley ' on Thu Apr 9 05:18:40 UTC 2009************************************************************/ Re-format filesystem In/tmp/hadoop/hadoop-shirdrn/dfs/name? (Y or N) Y11/06/22 07:33:36 INFO Namenode. FSNAMESYSTEM:FSOWNER=SHIRDRN,SHIRDRN11/06/22 07:33:36 INFO Namenode. FSNAMESYSTEM:SUPERGROUP=SUPERGROUP11/06/22 07:33:36 INFO Namenode. FSNAMESYSTEM:ISPERMISSIONENABLED=TRUE11/06/22 07:33:36 INFO Metrics. Metricsutil:unable to obtain HostNamejava.net.UnknownHostException:localhost.localdomain:localhost.localdomain a T JAVA.NET.INETADDRESS.GEtlocalhost (inetaddress.java:1353) at Org.apache.hadoop.metrics.MetricsUtil.getHostName (metricsutil.java:91) At Org.apache.hadoop.metrics.MetricsUtil.createRecord (metricsutil.java:80) at Org.apache.hadoop.hdfs.server.namen Ode. Fsdirectory.initialize (fsdirectory.java:73) at org.apache.hadoop.hdfs.server.namenode.fsdirectory.<init> ( fsdirectory.java:68) at org.apache.hadoop.hdfs.server.namenode.fsnamesystem.<init> (FSNamesystem.java:370) At Org.apache.hadoop.hdfs.server.namenode.NameNode.format (namenode.java:853) at ORG.APACHE.HADOOP.HDFS.SERVER.N Amenode. Namenode.createnamenode (namenode.java:947) at Org.apache.hadoop.hdfs.server.namenode.NameNode.main (Namenode.java : 964) 11/06/22 07:33:36 INFO Common. Storage:image file of size saved in 0 seconds.11/06/22 07:33:36 INFO Common. Storage:storage Directory/tmp/hadoop/hadoop-shirdrn/dfs/name has been successfully formatted.11/06/22 07:33:36 INFO Namenode. Namenode:shutdown_msg:/************************************************************shutdown_msg:shutting down NameNode at java.net.unknownhostexception:localhost.localdomain:localhost.localdomain************************************* ***********************/
The execution of the/bin/start-all.sh will not succeed.
You can see by executing the hostname command:
Java code
- [Shirdrn@localhost bin]# hostname
- Centos64
[Email protected] bin]# HOSTNAMECENTOS64
That is, Hadoop in the format of HDFs, the host name obtained through the hostname command is CENTOS64, and then in the/etc/hosts file mapping, not found, look at my/etc/hosts content:
Java code
- [Root @localhost bin]# cat /etc/hosts
- # do not remove the following line, or various programs
- # that require network functionality will fail.
- 127.0.
- Span class= "number" >192.168. 18.130 localhost localhost
[[email protected] bin]# cat/etc/hosts# do not remove the following line, or various programs# that require network funct Ionality'll fail.127.0.0.1 localhost localhost192.168.18.130 localhost localhost
In: Check the/etc/sysconfig/network file: hostname is the host name.
Modify in/etc/hosts
127.0.0.1 localhost centos64
192.168.18.130 localhost centos64
Host name Centos64 in the hosts can have an IP mapped to the corresponding.
2. or modify the hostname in/etc/sysconfig/network to localhost
Again: [[email protected] bin]#/etc/rc.d/init.d/network restart
After the above modification, it is normal to perform the format HDFs command and start the HDFs cluster.
Re-enable bin/start-all.sh
Then use the JPS.
The above is a standalone version of the hadoop1.2 installation, if it is installed in the cluster,
1. Add all slave IPs to the/etc/hosts in master,
Such as
192.168.18.130 H0
192.168.18.131 H1
192.168.18.132 H2
2. Set up SSH, login without password, see another blog
3. Modify Vi/home/hadoop1.2/conf/master
H0
Vi/home/hadoop1.2/conf/slave
H1
H2
Hadoop formatted HDFS error JAVA.NET.UNKNOWNHOSTEXCEPTION:CENTOS64