Hadoop"连接异常失败:java.net.ConnectException:连接被拒绝"

时间:2015-09-25 17:18:51

标签: hadoop2

我尝试在本地模式下运行Hadoop命令。 我在Mac OS X 10.10.5上运行,并且在将文件放入HDFS时遇到错误。 这是我的Hadoop命令的错误消息:

 $ sudo hadoop fs -put HG00103.mapped.ILLUMINA.bwa.GBR.low_coverage.20120522.bam /usr/ds/genomics
    Password:
    15/09/25 10:10:50 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
    put: Call From BlueMeanie/10.0.1.5 to localhost:9000 failed on connection exception: java.net.ConnectException: Connection refused; For more details see:  http://wiki.apache.org/hadoop/ConnectionRefused

以下是我系统的详细信息:

$ java -version
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)

$ hadoop version
Hadoop 2.3.0
Subversion http://svn.apache.org/repos/asf/hadoop/common -r 1567123
Compiled by jenkins on 2014-02-11T13:40Z
Compiled with protoc 2.5.0
From source with checksum dfe46336fbc6a044bc124392ec06b85
This command was run using /Users/davidlaxer/hadoop-`2.3.0/share/hadoop/common/hadoop-common-2.3.0.jar`

$ cat /etc/hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1   localhost
10.0.1.5    BlueMeanie
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost

$ telnet 10.1.1.5 9000
Trying 10.1.1.5...
^C
$ telnet localhost 9000
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
Trying fe80::1...
telnet: connect to address fe80::1: Connection refused
telnet: Unable to connect to remote host

$ env | grep HADOOP
HADOOP_HOME=/Users/dbl/hadoop-2.3.0/
HADOOP_CONF_DIR=/Users/dbl/hadoop-2.3.0/etc

$ cat core_site.xml

<configuration>
    <property>
        <name>fs.defaultFS</name>
        <value>hdfs://localhost:9000</value>
    </property>
</configuration>

$ cat hdfs-site.xml 
<configuration>
    <property>
        <name>dfs.replication</name>
        <value>1</value>
    </property>
</configuration>
$ cat yarn_site.xml 
<configuration>
    <property>
        <name>yarn.nodemanager.aux-services</name>
        <value>mapreduce_shuffle</value>
    </property>
</configuration>
$ cat mapred_site.xml 
<configuration>
    <property>
        <name>mapreduce.framework.name</name>
        <value>yarn</value>
    </property>
</configuration>

$ sbin/start-dfs.sh
Starting namenodes on [2015-09-25 16:36:54,540 WARN  [main] util.NativeCodeLoader (NativeCodeLoader.java:<clinit>(62)) - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
localhost]
[main]: ssh: Could not resolve hostname [main]: nodename nor servname provided, or not known
-: ssh: Could not resolve hostname -: nodename nor servname provided, or not known
Unable: ssh: Could not resolve hostname Unable: nodename nor servname provided, or not known
native-hadoop: ssh: Could not resolve hostname native-hadoop: nodename nor servname provided, or not known
load: ssh: Could not resolve hostname load: nodename nor servname provided, or not known
to: ssh: Could not resolve hostname to: nodename nor servname provided, or not known
for: ssh: Could not resolve hostname for: nodename nor servname provided, or not known
16:36:54,540: ssh: Could not resolve hostname 16:36:54,540: nodename nor servname provided, or not known
your: ssh: Could not resolve hostname your: nodename nor servname provided, or not known
platform...: ssh: Could not resolve hostname platform...: nodename nor servname provided, or not known
using: ssh: Could not resolve hostname using: nodename nor servname provided, or not known
builtin-java: ssh: Could not resolve hostname builtin-java: nodename nor servname provided, or not known
where: ssh: Could not resolve hostname where: nodename nor servname provided, or not known
applicable: ssh: Could not resolve hostname applicable: nodename nor servname provided, or not known
localhost: namenode running as process 99664. Stop it first.
2015-09-25: ssh: Could not resolve hostname 2015-09-25: nodename nor servname provided, or not known
WARN: ssh: Could not resolve hostname WARN: nodename nor servname provided, or not known
library: ssh: Could not resolve hostname library: nodename nor servname provided, or not known
classes: ssh: Could not resolve hostname classes: nodename nor servname provided, or not known
(NativeCodeLoader.java:<clinit>(62)): ssh: connect to host (NativeCodeLoader.java:<clinit>(62)) port 22: Operation timed out
util.NativeCodeLoader: ssh: connect to host util.NativeCodeLoader port 22: Operation timed out
cat: /Users/davidlaxer/hadoop-2.3.0/etc/hadoop/conf/slaves: No such file or directory
Starting secondary namenodes [2015-09-25 16:39:26,863 WARN  [main] util.NativeCodeLoader (NativeCodeLoader.java:<clinit>(62)) - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
0.0.0.0]
WARN: ssh: Could not resolve hostname WARN: nodename nor servname provided, or not known
[main]: ssh: Could not resolve hostname [main]: nodename nor servname provided, or not known
Unable: ssh: Could not resolve hostname Unable: nodename nor servname provided, or not known
to: ssh: Could not resolve hostname to: nodename nor servname provided, or not known
-: ssh: Could not resolve hostname -: nodename nor servname provided, or not known
native-hadoop: ssh: Could not resolve hostname native-hadoop: nodename nor servname provided, or not known
library: ssh: Could not resolve hostname library: nodename nor servname provided, or not known
for: ssh: Could not resolve hostname for: nodename nor servname provided, or not known
your: ssh: Could not resolve hostname your: nodename nor servname provided, or not known
platform...: ssh: Could not resolve hostname platform...: nodename nor servname provided, or not known
16:39:26,863: ssh: Could not resolve hostname 16:39:26,863: nodename nor servname provided, or not known
using: ssh: Could not resolve hostname using: nodename nor servname provided, or not known
builtin-java: ssh: Could not resolve hostname builtin-java: nodename nor servname provided, or not known
classes: ssh: Could not resolve hostname classes: nodename nor servname provided, or not known
where: ssh: Could not resolve hostname where: nodename nor servname provided, or not known
applicable: ssh: Could not resolve hostname applicable: nodename nor servname provided, or not known
0.0.0.0: secondarynamenode running as process 99006. Stop it first.
2015-09-25: ssh: Could not resolve hostname 2015-09-25: nodename nor servname provided, or not known
load: ssh: Could not resolve hostname load: nodename nor servname provided, or not known
(NativeCodeLoader.java:<clinit>(62)): ssh: connect to host (NativeCodeLoader.java:<clinit>(62)) port 22: Operation timed out
util.NativeCodeLoader: ssh: connect to host util.NativeCodeLoader port 22: Operation timed out

1 个答案:

答案 0 :(得分:3)

单节点模式下运行不需要启动 Namenode Datanode 等。

Single Node or Standalone 使用标准的hadoop安装 开箱即用 ,并要求您设置 { {1}} fs.defaultFS ,表示您的本地文件系统。

如果你想在 pseudo distributed 中运行(因为我猜你想从你的配置和你运行的事实file:///),你还必须记住之间的沟通守护进程使用start-dfs.sh执行,因此您需要:

  • 修改您的ssh文件(安装ssh 支持shd_config后)
  • 添加端口9000(我相信端口8020)。

然后,重新启动shd_config并检查您是否可以通过sshlocalhost建立联系。这可能是你在启动Namenode和Datanode时奇怪的消息。