0

我已经在我的 mac 上设置了一些东西来安装 hadoop。但是有这样的错误消息:

13/02/18 04:05:52 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:9000. Already tried 0 time(s).
13/02/18 04:05:53 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:9000. Already tried 1 time(s).
13/02/18 04:05:54 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:9000. Already tried 2 time(s).
13/02/18 04:05:55 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:9000. Already tried 3 time(s).
13/02/18 04:05:56 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:9000. Already tried 4 time(s).
13/02/18 04:05:57 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:9000. Already tried 5 time(s).
13/02/18 04:05:58 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:9000. Already tried 6 time(s).
13/02/18 04:05:59 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:9000. Already tried 7 time(s).
13/02/18 04:06:00 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:9000. Already tried 8 time(s).
13/02/18 04:06:01 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:9000. Already tried 9 time(s).
java.lang.RuntimeException: java.net.ConnectException: Call to localhost/127.0.0.1:9000 failed on connection exception: java.net.ConnectException: Connection refused
    at org.apache.hadoop.mapred.JobConf.getWorkingDirectory(JobConf.java:546)
    at org.apache.hadoop.mapred.FileInputFormat.setInputPaths(FileInputFormat.java:318)
    at org.apache.hadoop.examples.PiEstimator.estimate(PiEstimator.java:265)
    at org.apache.hadoop.examples.PiEstimator.run(PiEstimator.java:342)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
    at org.apache.hadoop.examples.PiEstimator.main(PiEstimator.java:351)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.hadoop.util.ProgramDriver$ProgramDescription.invoke(ProgramDriver.java:68)
    at org.apache.hadoop.util.ProgramDriver.driver(ProgramDriver.java:139)
    at org.apache.hadoop.examples.ExampleDriver.main(ExampleDriver.java:64)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:156)
Caused by: java.net.ConnectException: Call to localhost/127.0.0.1:9000 failed on connection exception: java.net.ConnectException: Connection refused
    at org.apache.hadoop.ipc.Client.wrapException(Client.java:1099)
    at org.apache.hadoop.ipc.Client.call(Client.java:1075)
    at org.apache.hadoop.ipc.RPC$Invoker.invoke(RPC.java:225)
    at $Proxy1.getProtocolVersion(Unknown Source)
    at org.apache.hadoop.ipc.RPC.getProxy(RPC.java:396)
    at org.apache.hadoop.ipc.RPC.getProxy(RPC.java:379)
    at org.apache.hadoop.hdfs.DFSClient.createRPCNamenode(DFSClient.java:119)
    at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:238)
    at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:203)
    at org.apache.hadoop.hdfs.DistributedFileSystem.initialize(DistributedFileSystem.java:89)
    at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:1386)
    at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:66)
    at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:1404)
    at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:254)
    at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:123)
    at org.apache.hadoop.mapred.JobConf.getWorkingDirectory(JobConf.java:542)
    ... 17 more
Caused by: java.net.ConnectException: Connection refused
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:599)
    at org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:206)
    at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:489)
    at org.apache.hadoop.ipc.Client$Connection.setupConnection(Client.java:434)
    at org.apache.hadoop.ipc.Client$Connection.setupIOstreams(Client.java:560)
    at org.apache.hadoop.ipc.Client$Connection.access$2000(Client.java:184)
    at org.apache.hadoop.ipc.Client.getConnection(Client.java:1206)
    at org.apache.hadoop.ipc.Client.call(Client.java:1050)
    ... 31 more

然后我进入jps查看服务,结果是:20635 jps

20466 任务跟踪器

20189 数据节点

20291 次要名称节点

我不知道如何处理这个错误。有人可以给我一个答案吗?多谢!!!

4

3 回答 3

2

实际上,由于 IP 配置错误,所有进程(hadoop 应该运行)都没有运行。我不熟悉 Mac OS,但在 linux 和 windows 上,我们需要将 hadoop 输入用于连接主机文件(etc/hosts),我该死确保它应该适用于 Mac。现在的重点是
您需要将您的 hadoop 条目作为本地机器(如 127.0.0.1)放入该文件中,
实际上您需要将其放在您机器的实际 IP 上,
例如
hadoop-machine 127.0.0.1 -->(这里放回环IP是错误的,因为hadoop会尝试连接这个IP)。
删除这个 127.0.0.1 并将你的机器的实际 IP 放在这个条目的前面。你可以很容易地找到你的mac机器的ip.这里有一些与hadoop没有直接关系的问题,但我想它们会对你有所帮助。
问题 1 ,问题 2 ,问题 3

于 2013-02-18T09:50:13.830 回答
1

这可能会有所帮助。但首先你必须使用命令删除早期的安装

rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup

然后你可以开始在你的 Mac 上全新安装 Hadoop。

第 1 步:安装 Homebrew

$ ruby​​ -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go )"

第 2 步:安装 Hadoop

$ brew 安装 hadoop

假设 brew 安装 Hadoop 1.2.1

第 3 步:配置 Hadoop

$ cd /usr/local/Cellar/hadoop/1.2.1/libexec

将以下行添加到 conf/hadoop-env.sh:

导出 HADOOP_OPTS="-Djava.security.krb5.realm= -Djava.security.krb5.kdc="

将以下行添加到配置标签内的 conf/core-site.xml 中:

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

将以下行添加到配置标签内的 conf/hdfs-site.xml 中:

<property>
<name>dfs.replication</name>
<value>1</value>
</property>

将以下行添加到配置标签内的 conf/mapred-site.xml 中:

 <property>
 <name>mapred.job.tracker</name>
 <value>localhost:9001</value>
 </property>

转到系统偏好设置 > 共享。确保选中“远程登录”。

$ ssh-keygen -t rsa $ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

第 4 步:启用 SSH 到 localhost

$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

第 5 步:格式化 Hadoop 文件系统

$ bin/hadoop 名称节点-格式

第 6 步:启动 Hadoop

$ bin/start-all.sh

确保所有 Hadoop 进程都在运行:

$ 日元

运行一个 Hadoop 示例:

还有一件事 !“brew update” 会将 hadoop 二进制文件更新到最新版本(目前为 1.2.1)。

于 2013-10-10T18:07:02.687 回答
1

我有同样的错误:ConnectException: Connection refused在所有的secondarynamenode 日志文件中。

但我也在namenode的日志文件中找到了这个:

2015-10-25 16:35:15,720 ERROR org.apache.hadoop.hdfs.server.namenode.NameNode: Failed to start namenode.
org.apache.hadoop.hdfs.server.common.InconsistentFSStateException: Directory /private/tmp/hadoop-admin/dfs/name is in an inconsistent state: storage directory does not exist or is not accessible.

因此我做了一个

hadoop namenode -format

问题就消失了。因此,错误消息只是关于名称节点没有成功启动的事实。

于 2015-10-25T17:21:03.117 回答