运行hadoop示例代码时出错

运行hadoop示例代码时出错,hadoop,runtime-error,Hadoop,Runtime Error,我正在尝试运行示例pi map red示例代码。在伪分布式模式下运行时,发生以下错误。我已经按照hadoop站点中的说明完成了所有设置。我已经安装了ssh,配置文件也已正确设置 hadoop_admin@ubuntu:~/hadoop-1.0.4$ sudo bin/hadoop jar hadoop-examples-1.0.4.jar pi 10 10 Number of Maps = 10 Samples per Map = 10 13/02/13 14:47:34 INFO ipc.

我正在尝试运行示例pi map red示例代码。在伪分布式模式下运行时,发生以下错误。我已经按照hadoop站点中的说明完成了所有设置。我已经安装了ssh,配置文件也已正确设置


hadoop_admin@ubuntu:~/hadoop-1.0.4$ sudo bin/hadoop jar hadoop-examples-1.0.4.jar pi 10 10
Number of Maps  = 10
Samples per Map = 10
13/02/13 14:47:34 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:9000. Already tried 0 time(s).
13/02/13 14:47:35 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:9000. Already tried 1 time(s).
13/02/13 14:47:36 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:9000. Already tried 2 time(s).
13/02/13 14:47:37 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:9000. Already tried 3 time(s).
13/02/13 14:47:38 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:9000. Already tried 4 time(s).
13/02/13 14:47:39 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:9000. Already tried 5 time(s).
13/02/13 14:47:40 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:9000. Already tried 6 time(s).
13/02/13 14:47:41 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:9000. Already tried 7 time(s).
13/02/13 14:47:42 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:9000. Already tried 8 time(s).
13/02/13 14:47:43 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: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: 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.(DFSClient.java:238)
    at org.apache.hadoop.hdfs.DFSClient.(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:692)
    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.apac

有人能帮我确定为什么会出现上述错误以及如何纠正它吗

当系统上的Datanode守护程序未启动时会出现此问题。请使用“jps”命令检查已启动的守护程序。如果未启动,请使用以下命令手动启动Datanode守护程序:

bin/hadoop-daemon.sh start datanode。

当系统上的datanode守护程序未启动时,会出现此问题。请使用“jps”命令检查已启动的守护程序。如果未启动,请使用以下命令手动启动datanode守护程序:

bin/hadoop-daemon.sh启动datanode。

在我的例子中,我参考了上一篇文章,我能够解决这个问题

  • 删除在core-site.xml中设置的tmp目录
  • hadoop名称节点-格式
  • start-dfs.sh或start-all.sh
  • 太平绅士

  • 在我的情况下,我在上引用了这篇文章,我能够解决这个问题

  • 删除在core-site.xml中设置的tmp目录
  • hadoop名称节点-格式
  • start-dfs.sh或start-all.sh
  • 太平绅士

  • 如果上述注释确实对您有帮助,请尝试其他操作。删除您的日志文件和在hdfs.site.xml的“dfs.data.dir”属性文件中输入的文件。格式化系统并重新启动所有守护进程。这可能会解决您的问题。如果上述注释确实对您有帮助,请尝试其他操作。删除您的日志文件和您输入的文件hdfs.site.xml中的“dfs.data.dir”属性文件。格式化系统并重新启动所有守护进程。这可能会解决您的问题。