Hadoop formatted HDFS error JAVA.NET.UNKNOWNHOSTEXCEPTION:CENTOS64

Source: Internet
Author: User

 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
  1. [Shirdrn@localhost bin]$ Hadoop namenode-format
  2. 11/06/: + INFO namenode. Namenode:startup_msg:
  3. /************************************************************
  4. Startup_msg:starting NameNode
  5. Startup_msg: <span style= "Color:rgb (255, 0, 0); >host = Java.net.UnknownHostException:centos64:centos64
  6. </span>startup_msg:args = [-format]
  7. Startup_msg:version = 0.20.0
  8. 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
  9. ************************************************************/
  10. Re-format filesystem In/tmp/hadoop/hadoop-shirdrn/dfs/name? (Y or N) Y
  11. 11/06/: £ º $INFO Namenode. Fsnamesystem:fsowner=shirdrn,shirdrn
  12. 11/06/: £ º $INFO Namenode. Fsnamesystem:supergroup=supergroup
  13. 11/06/: £ º $INFO Namenode. Fsnamesystem:ispermissionenabled=true
  14. 11/06/: £ º $INFO metrics. Metricsutil:unable to obtain HostName
  15. Java.net.UnknownHostException: <span style="Color:rgb (255, 0, 0); >localhost.localdomain:localhost.localdomain
  16. </span> at Java.net.InetAddress.getLocalHost (Inetaddress.java:1353)
  17. At Org.apache.hadoop.metrics.MetricsUtil.getHostName (Metricsutil.java:)
  18. At Org.apache.hadoop.metrics.MetricsUtil.createRecord (Metricsutil.java:)
  19. At Org.apache.hadoop.hdfs.server.namenode.FSDirectory.initialize (Fsdirectory.java:)
  20. At Org.apache.hadoop.hdfs.server.namenode.fsdirectory.<init> (Fsdirectory.java:)
  21. At Org.apache.hadoop.hdfs.server.namenode.fsnamesystem.<init> (Fsnamesystem.java:370)
  22. At Org.apache.hadoop.hdfs.server.namenode.NameNode.format (Namenode.java:853)
  23. At Org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode (Namenode.java:947)
  24. At Org.apache.hadoop.hdfs.server.namenode.NameNode.main (Namenode.java:964)
  25. 11/06/: £ º $INFO common.  Storage:image file of size saved in 0 seconds.
  26. 11/06/: £ º $INFO common.  Storage:storage Directory/tmp/hadoop/hadoop-shirdrn/dfs/name has been successfully formatted.
  27. 11/06/: £ º $INFO Namenode. Namenode:shutdown_msg:
  28. /************************************************************
  29. Shutdown_msg:shutting down NameNode at Java.net.UnknownHostException:localhost.localdomain:localhost.localdomain
  30. ************************************************************/
 [[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
    1. [Shirdrn@localhost bin]# hostname
    2. 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
    1. [Root @localhost  bin]# cat /etc/hosts  
    2. # do not remove the following line, or various  programs  
    3. # that require network functionality will fail.   
    4. 127.0.
    5. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.