爱折腾的人总是会出线各种奇怪的问题。记得之前听一位大师讲过,我们不能踩完前进路上的所有坑前进,而应该学会怎样避开前进路上的坑,踩得坑越多,可能你的经验越丰富,但是付出的时间代价可能不是经验能换来的。我很认同这句话,但是我们学习过程中难免会踩各种各样的坑,今天这个小小的坑,让我在坑里从上午10:00,一直折腾到下午16:00+,最后实在找不出来哪里问题,决定去问大神(也算是本项目组Hadoop专家),然而他也没遇到过,从一头雾水,到解决他只用了不到10分钟,在他的面前,我深深体会到了还再学校的技术小白和公司的技术骨干之间的鸿沟(这是个容易扯着蛋的鸿沟)。
一、问题出现的原因
本来我的Hadoop2.7.2是在公司的电脑上进行配置的,因为自己回去要学习,所以就把台式机中的虚拟机都拷贝到笔记本中了,然后各种配置IP等相关的,然后就启动分布式环境了,命令:
hadoop@master$ ${HADOOP_HOME}/sbin/start.dfs.sh
现象:主节点的namenode、secondarynamenode启动成功,但是slave节点datenode启动不成功。
查看slave的输出日志,显示如下:
2016-07-28 23:12:03,301 INFO org.apache.hadoop.http.HttpServer2: Added filter static_user_filter (class=org.apache.hadoop.http.lib.StaticUserWebFilter$StaticUserFilter) to context logs
2016-07-28 23:12:03,336 INFO org.apache.hadoop.http.HttpServer2: HttpServer.start() threw a non Bind IOException
java.net.BindException: Port in use: localhost:0
at org.apache.hadoop.http.HttpServer2.openListeners(HttpServer2.java:919)
at org.apache.hadoop.http.HttpServer2.start(HttpServer2.java:856)
at org.apache.hadoop.hdfs.server.datanode.web.DatanodeHttpServer.<init>(DatanodeHttpServer.java:104)
at org.apache.hadoop.hdfs.server.datanode.DataNode.startInfoServer(DataNode.java:759)
at org.apache.hadoop.hdfs.server.datanode.DataNode.startDataNode(DataNode.java:1108)
at org.apache.hadoop.hdfs.server.datanode.DataNode.<init>(DataNode.java:428)
at org.apache.hadoop.hdfs.server.datanode.DataNode.makeInstance(DataNode.java:2370)
at org.apache.hadoop.hdfs.server.datanode.DataNode.instantiateDataNode(DataNode.java:2257)
at org.apache.hadoop.hdfs.server.datanode.DataNode.createDataNode(DataNode.java:2304)
at org.apache.hadoop.hdfs.server.datanode.DataNode.secureMain(DataNode.java:2481)
at org.apache.hadoop.hdfs.server.datanode.DataNode.main(DataNode.java:2505)
Caused by: java.net.BindException: Cannot assign requested address
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.mortbay.jetty.nio.SelectChannelConnector.open(SelectChannelConnector.java:216)
at org.apache.hadoop.http.HttpServer2.openListeners(HttpServer2.java:914)
... 10 more
……(此处省略了好多内容)
2016-07-28 23:12:03,356 INFO org.apache.hadoop.util.ExitUtil: Exiting with status 1
2016-07-28 23:12:03,363 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: SHUTDOWN_MSG:
/************************************************************
SHUTDOWN_MSG: Shutting down DataNode at slave01/192.168.75.101
************************************************************/
二、日志分析
很自然,从这个日志中提取两个关键的地方
(1)java.net.BindException: Port in use: localhost:0
(2)Caused by: java.net.BindException: Cannot assign requested address
其中第一个是现象,是说端口被占用,到底哪个端口被占用,只给出了主机localhost,并且给出了localhost的端口0,因为配置都是在台式机上面配置的,并且经过测试都是可以用的,基本可以判断,端口被占用基本上是不可能发生的(这些都是自己猜测),那么是什么导致的的?
第二个说明的失败导致的原因,说网络绑定异常,不能分配请求的地址,这个其实也没什么用。
三、自己的小经验
对于master节点都启动成功,而datenode启动不成功,我们第一时间想到的就是namenode和datenode不一致导致的。于是我们将master的namenode进行格式化,格式化操作之前需要删除data文件夹,具体参考我之前的一篇博客:Hadoop2.7.x中所有的DataNode都启动不了解决办法
但是发现还是不行,然后就各种百度,经过了一个多小时的时间,耐心也被消耗的差不多了,然后还是基本可以锁定在格式化,主从数据不一致这方面,然后我删除了namenode上面的defaultFS目录下的所有文件,我的是/opt/data/,我的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EAEZhIS1nzAdTOHkJLavyCpwoCrIbKQltq/IJxwISX+BhAkRUwhjdy/YLMrGmNHzdiEWi6y0fOcMbxn01Tv0clbc5cvQJa4TQpIitW/hDFCGrB/gWGUtTlU613R2l+xFo18dMbwnk0z53okzRfgcuz2QVLE6ZEG7l/QCMBwEbMjtmey0TnDezbNnBUSCWGHc2na7YOkiDa0G7J/gWH8q+uwW0gqOmd475oLefPar/V00COBQKadI/n3L1DOKvwSBefWwkfnDO87hGR9XH8tejPH9mdjbgu4BSZctfOs4Bm29K5GTx0tOQN7e+rVGt57VufIULDVvBi/0c4Tq3YgnAnfI7EvYUd+kGm67zmxXmsABDK3iVCaQmKdqAEIB0IyHTwBGACMVgGIAIQEQAQgJAAiMEpI0Z0jWls4ZURH3ibNz7K5gwtiuJCi+yMYHxOUuczSlJ1vbyEkEEaQkOZxjng4LGZGMIWTEt7n3hTdQgpxjsj1zwKqk8P9IHJLSK6tqUwT1cPe8S12xo1CL6SMwvlWZCG5h3l24CXvTdDhRhHqHMGZWnf6QaixnP7Nde9HbsmbU2WL4BOS5UahoCNJ59Au5FvV3BXptwU2r9ePr0ca5hzBnsObb+tW2+zQbqSQ7ATZjRIChdT3ish1wQvjyukY2g1wjlBMIaRcH4lRS1ZeSAEW5flkQkKPdDsMmSMxzhHs0K7LD2JIj/ROfpSdPUfb1MAtJHujBNa3gsm9zxVhjnRT9F61c/v5NC49RHUuP4gQIekJMvsX0K872Jsa8ELiNkqQf9J9K1y5h18RVu1uit7vkZb9Qh3NXbZ1GJuCBLgwEyFtYjOZbxIAfbkwIbEvggBYnAsTEgBpAiEBEAEICYAIQEgARABCAiACEBIAEYCQAIgAhARABCAkACIAIQEQAQgJgAhASABEAEICIAIQEgARgJAAiACEBEAEICQAIvB/rskDPzeDWIQAAAAASUVORK5CYII=" alt="" />
此时删除/opt/data下所有的文件,然后在执行namenode格式化操作,然后启动成功。
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPgAAABMCAIAAADP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NZjoYt0I7RSW1N5bJWvIL2DR0fgN+fnFAiqbLj8LPL45DR1P7fRjURYagZ6ETchoUOhkCCp0MAYVOhoBCJ0NAoZMhoNDJEFDoZAgodDIEFDoZAgqdDIH7i5AB4IpOhsD9ofnzA1x9Mbfy93345wP8ex/+O46jyh9cLd0DUOUv8D+nIVBQS0ydnAAAAABJRU5ErkJggg==" alt="" />
四、错误再次出现
错误的再次出现也意味着上述的方法行不通,然后从上午十点开始就一直折腾这个问题,中午也没睡午觉,到了下午16:00,实在解决不了了,决定去请教Hadoop布道师,他拿到这个问题,第一反映是为什么会出现这个问题,他自己也没遇到过,然后他就开始排错,最后修改了两处内容,其中第一处应该不是必要的,第二处是关键。
(1)在core-site.xml中添加了namenode 和 Datanode的目录地址,如下:
<!-- Put site-specific property overrides in this file. --> <configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://master:9000</value>
</property> <property>
<name>dfs.name.dir</name>
<value>/opt/data/namenode</value>
</property> <property> <name>dfs.data.dir</name>
<value>/opt/data/datanode</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/opt/data/tmp</value>
</property>
</configuration>
(2)重点,导致问题的根本原因,在/etc/hosts文件中
之前不知道看谁的博客,说在hosts文件中删除多余的IP与主机名的对应关系(之前貌似也是ipc通信不成功,然后删除了127.0.0.1和0.0.0.1)之后就成为了如下的样子:
但是根据提示,(1)java.net.BindException: Port in use: localhost:0
(2)Caused by: java.net.BindException: Cannot assign requested address