专栏首页Java成神之路hadoop_异常_01_ Unable to determine address of the host-falling back to "localhost" address java.net.U

hadoop_异常_01_ Unable to determine address of the host-falling back to "localhost" address java.net.U

一、异常现象

安装好hadoop之后,执行格式化namenode命令时,抛出以下异常:

18/03/21 21:02:10 WARN net.DNS: Unable to determine local hostname -falling back to "localhost"
java.net.UnknownHostException: rayner: rayner
        at java.net.InetAddress.getLocalHost(InetAddress.java:1475)
        at org.apache.hadoop.net.DNS.resolveLocalHostname(DNS.java:284)
        at org.apache.hadoop.net.DNS.<clinit>(DNS.java:61)
        at org.apache.hadoop.hdfs.server.namenode.NNStorage.newBlockPoolID(NNStorage.java:991)
        at org.apache.hadoop.hdfs.server.namenode.NNStorage.newNamespaceInfo(NNStorage.java:600)
        at org.apache.hadoop.hdfs.server.namenode.FSImage.format(FSImage.java:162)
        at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:1125)
        at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1567)
        at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1694)
Caused by: java.net.UnknownHostException: rayner
        at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
        at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901)
        at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1295)
        at java.net.InetAddress.getLocalHost(InetAddress.java:1471)
        ... 8 more
18/03/21 21:02:10 WARN net.DNS: Unable to determine address of the host-falling back to "localhost" address
java.net.UnknownHostException: rayner: rayner
        at java.net.InetAddress.getLocalHost(InetAddress.java:1475)
        at org.apache.hadoop.net.DNS.resolveLocalHostIPAddress(DNS.java:307)
        at org.apache.hadoop.net.DNS.<clinit>(DNS.java:62)
        at org.apache.hadoop.hdfs.server.namenode.NNStorage.newBlockPoolID(NNStorage.java:991)
        at org.apache.hadoop.hdfs.server.namenode.NNStorage.newNamespaceInfo(NNStorage.java:600)
        at org.apache.hadoop.hdfs.server.namenode.FSImage.format(FSImage.java:162)
        at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:1125)
        at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1567)
        at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1694)
Caused by: java.net.UnknownHostException: rayner
        at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
        at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901)
        at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1295)
        at java.net.InetAddress.getLocalHost(InetAddress.java:1471)
        ... 8 more

二、异常原因

是因为更改了虚拟机的hostname

vim  /etc/sysconfig/network

而/etc/hosts  下的文件没有修改

三、异常解决

(1)编辑 /etc/hosts  文件

vim /etc/hosts 

(2)将 主机IP 和 对应的主机名称 进行映射

添加下图红框中内容

192.168.1.102  rayner

三、参考资料

1.Unable to determine local hostname -falling back to "localhost"

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • hive_异常_01_hive启动异常-Role admin already exists(未解决)

    猜想可能是hive版本的问题,可是CDH版本一致的情况下,还会出现版本冲突的问题吗?纠结

    shirayner
  • hive_异常_01_(未解决)FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask.

    单独的 hadoop、hbase 、hive 都是正常的,但是在 hive 整合hbase 时,在 hive中输入以下建表语句,

    shirayner
  • Exception in thread "main" java.lang.NoClassDefFoundError: UDP_Receive (wrong na me: com/ray/net/UDP

        今晚学习java网络编程,在eclipse中写了两个个java文件,一个发送端UDP_Send2.java,一个接收端UDP_Receive.java。...

    shirayner
  • Spark Spark {{JAVA_HOME}}找不到

    发现换一台机器提交作业就没有问题,怀疑是版本的问题,经过对比,原来是我编译Spark所使用的Hadoop版本和线上Hadoop版本不一致导致的,当前使用Hado...

    smartsi
  • Hive多分隔符支持示例

    如何将上述事例数据加载到Hive表(multi_delimiter_test)中,表结构如下:

    Fayson
  • java.lang.IllegalArgumentException: URLDecoder: Incomplete trailing escape (%) pattern 的问题处理

      java.lang.IllegalArgumentException: URLDecoder: Incomplete trailing escape (%)...

    黑泽君
  • 一个一年没解决的ClassNotFoundException|类加载机制探索

    在一开始写Android的时候经常碰到一些ClassNotFoundException,大部分情况下是少导入了什么包导致的。我碰到一个困扰了一年之久的Class...

    逮虾户
  • Flink 解决 No ExecutorFactory found to execute the application

    shengjk1
  • Hbase集群搭建最常见的问题及解决办法

    问题一:使用自己搭建的zookeeper集群而不使用hbase自带的zookeeper解决办法?

    z小赵
  • 360道C语言实战(题目+源码)

    岁月匆匆转眼即逝,计算机这行真的不像我当年报志愿的时候想的那样上天入地无所不能,给自己的大学打分的话勉强打个75分吧。

    C语言入门到精通

扫码关注云+社区

领取腾讯云代金券