datanode端口占用错误

来源:3-8 HDFS伪分布式环境搭建

Chuansssss

2017-12-29

老师,我在使用./start-dfs.sh启动伪分布式hdfs的时候,namendoe和secondarynamenode都可以正常启动,但是本机的datanode不能正常启动。我查看了datanode的启动日志,显示端口被占用。

2017-12-29 19:44:47,991 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:951)

at org.apache.hadoop.http.HttpServer2.start(HttpServer2.java:887)

at org.apache.hadoop.hdfs.server.datanode.web.DatanodeHttpServer.<init>(DatanodeHttpServer.java:105)

at org.apache.hadoop.hdfs.server.datanode.DataNode.startInfoServer(DataNode.java:785)

at org.apache.hadoop.hdfs.server.datanode.DataNode.startDataNode(DataNode.java:1138)

at org.apache.hadoop.hdfs.server.datanode.DataNode.<init>(DataNode.java:451)

at org.apache.hadoop.hdfs.server.datanode.DataNode.makeInstance(DataNode.java:2406)

at org.apache.hadoop.hdfs.server.datanode.DataNode.instantiateDataNode(DataNode.java:2293)

at org.apache.hadoop.hdfs.server.datanode.DataNode.createDataNode(DataNode.java:2340)

at org.apache.hadoop.hdfs.server.datanode.DataNode.secureMain(DataNode.java:2517)

at org.apache.hadoop.hdfs.server.datanode.DataNode.main(DataNode.java:2541)

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:444)

at sun.nio.ch.Net.bind(Net.java:436)

at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)

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:946)

... 10 more

2017-12-29 19:44:47,994 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: Shutdown complete.

2017-12-29 19:44:47,994 FATAL org.apache.hadoop.hdfs.server.datanode.DataNode: Exception in secureMain

java.net.BindException: Port in use: localhost:0

at org.apache.hadoop.http.HttpServer2.openListeners(HttpServer2.java:951)

at org.apache.hadoop.http.HttpServer2.start(HttpServer2.java:887)

at org.apache.hadoop.hdfs.server.datanode.web.DatanodeHttpServer.<init>(DatanodeHttpServer.java:105)

at org.apache.hadoop.hdfs.server.datanode.DataNode.startInfoServer(DataNode.java:785)

at org.apache.hadoop.hdfs.server.datanode.DataNode.startDataNode(DataNode.java:1138)

at org.apache.hadoop.hdfs.server.datanode.DataNode.<init>(DataNode.java:451)

at org.apache.hadoop.hdfs.server.datanode.DataNode.makeInstance(DataNode.java:2406)

at org.apache.hadoop.hdfs.server.datanode.DataNode.instantiateDataNode(DataNode.java:2293)

at org.apache.hadoop.hdfs.server.datanode.DataNode.createDataNode(DataNode.java:2340)

at org.apache.hadoop.hdfs.server.datanode.DataNode.secureMain(DataNode.java:2517)

at org.apache.hadoop.hdfs.server.datanode.DataNode.main(DataNode.java:2541)

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:444)

at sun.nio.ch.Net.bind(Net.java:436)

at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)

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:946)

... 10 more

2017-12-29 19:44:47,995 INFO org.apache.hadoop.util.ExitUtil: Exiting with status 1

2017-12-29 19:44:47,997 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: SHUTDOWN_MSG: 


所用环境是老师所提供的虚拟机,因为不能识别hadoop000这个主机名,我把slaves文件中的localhost换成了虚拟机的ip。


请问老师有什么解决的方法。

写回答

1回答

Michael_PK

2017-12-29

你把hadoop000映射到你自己的IP

0
4
Chuansssss
回复
Michael_PK
老师 我修改了datanode对应的clusterID,解决问题了
2017-12-30
共4条回复

10小时入门大数据

【毕设】大数据零基础入门必备,轻松掌握Hadoop开发核心技能

1456 学习 · 656 问题

查看课程