Hadoop启动HDFS时DataNode未启动
在用$HADOOP_HOME/sbin/start-dfs.sh启动HDFS时发现只有NameNode和SecondaryNameNode启动,没有DataNode。
查看logs下的DataNode日志中显示如下错误:
WARN org.apache.hadoop.hdfs.server.datanode.DataNode: IOException in offerService java.io.EOFException: End of File Exception between local host is: "hadoop/127.0.0.1"; destination host is: "hadoop":8020; : java.io.EOFException; For more details see: http://wiki.apache.org/hadoop/EOFException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.apache.hadoop.net.NetUtils.wrapWithMessage(NetUtils.java:791) at org.apache.hadoop.net.NetUtils.wrapException(NetUtils.java:764) at org.apache.hadoop.ipc.Client.call(Client.java:1508) at org.apache.hadoop.ipc.Client.call(Client.java:1441) at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:230) at com.sun.proxy.$Proxy16.sendHeartbeat(Unknown Source) at org.apache.hadoop.hdfs.protocolPB.DatanodeProtocolClientSideTranslatorPB.sendHeartbeat(DatanodeProtocolClientSideTranslatorPB.java:154) at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.sendHeartBeat(BPServiceActor.java:406)
查资料得知如下解决办法:
修改/etc/hosts中的内容,注意要删除掉多余项,并注释掉127.0.0.1 localhost回环地址,这里我已经把127.0.0.1注释了,应该是多余项没有删掉引起的。
此外若/etc/hostname中的名称不一致也要修改并重启。
参考资料:https://blog.csdn.net/qqq824908000/article/details/70789303