hadoop 集群启动时 Address already in use 解决方法

    搭建好hadoop集群之后,运行start-all.sh脚本,发现有如下报错

starting namenode, logging to /usr/local/hadoop/libexec/../logs/hadoop-hadoop-namenode-we-home-server.out
homeserver: starting datanode, logging to /usr/local/hadoop/libexec/../logs/hadoop-hadoop-datanode-homeserver.out
we-home-server: starting secondarynamenode, logging to /usr/local/hadoop/libexec/../logs/hadoop-hadoop-secondarynamenode-we-home-server.out
we-home-server: Exception in thread "main" java.net.BindException: Address already in use
we-home-server:         at sun.nio.ch.Net.bind(Native Method)
we-home-server:         at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:124)
we-home-server:         at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59)
we-home-server:         at org.mortbay.jetty.nio.SelectChannelConnector.open(SelectChannelConnector.java:216)
we-home-server:         at org.apache.hadoop.http.HttpServer.start(HttpServer.java:581)
we-home-server:         at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode$1.run(SecondaryNameNode.java:216)
we-home-server:         at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode$1.run(SecondaryNameNode.java:190)
we-home-server:         at java.security.AccessController.doPrivileged(Native Method)
we-home-server:         at javax.security.auth.Subject.doAs(Subject.java:396)
starting jobtracker, logging to /usr/local/hadoop/libexec/../logs/hadoop-hadoop-jobtracker-we-home-server.out

log中说明错误 Address already in use,这是因为有上次的运行datanode的进程没有终止,解决方法,

netstat -antup

运行这个命令后,找出占用50030端口的那个进程的PID,然后将其终止

kill -9 <PID>

然后,再重新启动hadoop集群,没有报错。

hadoop@we-home-server:/usr/local/hadoop/bin$ ./start-all.sh
starting namenode, logging to /usr/local/hadoop/libexec/../logs/hadoop-hadoop-namenode-we-home-server.out
homeserver: starting datanode, logging to /usr/local/hadoop/libexec/../logs/hadoop-hadoop-datanode-homeserver.out
we-home-server: starting secondarynamenode, logging to /usr/local/hadoop/libexec/../logs/hadoop-hadoop-secondarynamenode-we-home-server.out
starting jobtracker, logging to /usr/local/hadoop/libexec/../logs/hadoop-hadoop-jobtracker-we-home-server.out
homeserver: starting tasktracker, logging to /usr/local/hadoop/libexec/../logs/hadoop-hadoop-tasktracker-homeserver.out
hadoop@we-home-server:/usr/local/hadoop/bin$
原文地址:https://www.cnblogs.com/lxs0731/p/2964913.html