8021 连接异常失败:java.net.ConnectException: Connection denied at org.apache.hadoop.ipc.Client.wrapException(Client.java:1095)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10617595/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 01:51:02  来源:igfitidea点击:

8021 failed on connection exception: java.net.ConnectException: Connection refused at org.apache.hadoop.ipc.Client.wrapException(Client.java:1095)

javahadoophdfs

提问by waqas

Hi I am trying to configure Hadoop 1.0. in pseudodistributed mode by following this blog.

嗨,我正在尝试配置 Hadoop 1.0。通过关注此博客以伪分布式模式。

http://hadoop-tutorial.blogspot.de/2010/11/running-hadoop-in-pseudo-distributed.html?showComment=1337083501000#c615470573579885293.

http://hadoop-tutorial.blogspot.de/2010/11/running-hadoop-in-pseudo-distributed.html?showComment=1337083501000#c615470573579885293

But when I run the pi example given in the hadoop distribution, I get the error mentioned in title. Can someone please help me and guide me how can I fix this problem. Also its a request that please suggest solution as well if possible along with pinpinting the problem.

但是当我运行 hadoop 发行版中给出的 pi 示例时,我收到了标题中提到的错误。有人可以帮助我并指导我如何解决这个问题。如果可能的话,也请提出解决方案并确定问题。

here is what i get by running jps

这是我通过运行 jps 得到的

8322 Jps
7611 SecondaryNameNode
7474 DataNode
7341 NameNode

Here is complete error message.

这是完整的错误消息。

Number of Maps  = 10
Samples per Map = 100
Wrote input for Map #0
Wrote input for Map #1
Wrote input for Map #2
Wrote input for Map #3
Wrote input for Map #4
Wrote input for Map #5
Wrote input for Map #6
Wrote input for Map #7
Wrote input for Map #8
Wrote input for Map #9
Starting Job
12/05/16 13:11:56 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:8021. Already tried 0 time(s).
12/05/16 13:11:57 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:8021. Already tried 1 time(s).
12/05/16 13:11:58 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:8021. Already tried 2 time(s).
12/05/16 13:11:59 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:8021. Already tried 3 time(s).
12/05/16 13:12:00 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:8021. Already tried 4 time(s).
12/05/16 13:12:01 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:8021. Already tried 5 time(s).
12/05/16 13:12:02 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:8021. Already tried 6 time(s).
12/05/16 13:12:03 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:8021. Already tried 7 time(s).
12/05/16 13:12:04 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:8021. Already tried 8 time(s).
12/05/16 13:12:05 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:8021. Already tried 9 time(s).
java.net.ConnectException: Call to localhost/127.0.0.1:8021 failed on connection exception: java.net.ConnectException: Connection refused
        at org.apache.hadoop.ipc.Client.wrapException(Client.java:1095)
        at org.apache.hadoop.ipc.Client.call(Client.java:1071)
        at org.apache.hadoop.ipc.RPC$Invoker.invoke(RPC.java:225)
        at org.apache.hadoop.mapred.$Proxy2.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.mapred.JobClient.createRPCProxy(JobClient.java:480)
        at org.apache.hadoop.mapred.JobClient.init(JobClient.java:474)
        at org.apache.hadoop.mapred.JobClient.<init>(JobClient.java:457)
        at org.apache.hadoop.mapred.JobClient.runJob(JobClient.java:1260)
        at org.apache.hadoop.examples.PiEstimator.estimate(PiEstimator.java:297)
        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:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        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:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:156)
Caused by: java.net.ConnectException: Connection refused
        at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
        at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:701)
        at org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:206)
        at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:656)
        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.access00(Client.java:184)
        at org.apache.hadoop.ipc.Client.getConnection(Client.java:1202)
        at org.apache.hadoop.ipc.Client.call(Client.java:1046)
        ... 24 more

回答by Chris White

Your jpsoutput shows that you do not have a JobTracker nor TaskTracker running - hence the connection issue when trying to communicate with the jobtracker.

您的jps输出显示您没有运行 JobTracker 或 TaskTracker - 因此在尝试与 jobtracker 通信时出现连接问题。

Check the logs for the jobtracker ($HADOOP_HOME/logs/*.jobtracker*.log) to see if there is an error message describing why it hasn't started (how did you start the cluster - start-all.shor start-dfs.sh, maybe try running start-mapred.shto see if that starts up your map reduce services)?

检查 jobtracker ( $HADOOP_HOME/logs/*.jobtracker*.log)的日志,看看是否有错误消息描述它为什么没有启动(你是如何启动集群的 -start-all.sh或者start-dfs.sh,也许尝试运行start-mapred.sh看看是否启动了你的 map reduce 服务)?

回答by Tejas Patil

Looks like this is some connection related issue. Is your jobtracker and trasktracker running correctly ?

看起来这是一些与连接相关的问题。您的 jobtracker 和 trasktracker 运行正常吗?

See this link

看这个链接

Edit:

编辑:

Read the Appendix A herein Definitive Guide. Its has entire steps for setting up a hadoop server in all 3 modes. I think that your configurations might be creating problems so use those that are prescribed in the book. Also check if password-less SSH is working fine on yr setup.

阅读附录A这里权威指南中。它具有在所有 3 种模式下设置 hadoop 服务器的完整步骤。我认为您的配置可能会产生问题,因此请使用书中规定的配置。还要检查无密码 SSH 在 yr 设置中是否正常工作。

回答by Haiping Fan

i met same issue, it is becasue hadoop 1.0.x has a difference need config two variables in hadoop_env.sh:

我遇到了同样的问题,这是因为 hadoop 1.0.x 有不同,需要在 hadoop_env.sh 中配置两个变量:

export HADOOP_HEAPSIZE=2000

导出 HADOOP_HEAPSIZE=2000

Extra Java runtime options. Empty by default.

额外的 Java 运行时选项。默认为空。

export HADOOP_OPTS=-server

导出 HADOOP_OPTS=-服务器

export HADOOP_OPTS="-Djava.security.krb5.realm=OX.AC.UK -Djava.security.krb5.kdc=kdc0.ox.ac.uk:kdc1.ox.ac.uk"

export HADOOP_OPTS="-Djava.security.krb5.realm=OX.AC.UK -Djava.security.krb5.kdc=kdc0.ox.ac.uk:kdc1.ox.ac.uk"

when you add these two variables, you will not see any error or warning during starting daemons, so that you can resolve your issue. good luck!

添加这两个变量后,您将不会在启动守护进程期间看到任何错误或警告,因此您可以解决您的问题。祝你好运!

wish my answer can help other guys:)

希望我的回答可以帮助其他人:)

回答by GotJazz

From the jps output looks like the TaskTrackerand JobTrackerare not running. Try running:

从 jps 输出看起来像TaskTracker并且JobTracker没有运行。尝试运行:

start-mapred.sh 

This would start the TaskTrackerand JobTrackerand try rerunning job.

这将启动TaskTrackerJobTracker和尝试重新运行工作。