2013-02-13 124 views
1

我想運行示例pi地圖紅色示例代碼。在僞分佈式模式下運行時發生以下錯誤。我已經按照hadoop網站的指示完成了所有設置。我安裝了ssh並且配置文件也正確設置了。錯誤運行hadoop示例代碼


[email protected]:~/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 

有人可以幫助我確定爲什麼上述錯誤即將到來,以及如何糾正它。

回答

1

這個問題是當系統上的Datanode守護進程使用「JPS」不start.check啓動的守護進程command.If它沒有啓動,手動啓動Datanode的守護程序通過使用命令:
斌/ Hadoop的守護進程。 sh啓動datanode。

+0

心不是幫助解決問題 – Bala 2013-02-13 10:15:21

+0

如果上述評論不會幫助你,嘗試其他的事情。刪除您的日誌文件和您在hdfs.site.xml中的「dfs.data.dir」屬性文件中輸入的文件。格式化系統並再次啓動所有守護程序。這可能會解決您的問題。 – 2013-02-13 11:21:26

0

就我而言,我提到Namenode not getting started的帖子,我可以解決這個問題。

  1. 刪除您在core-site.xml中設置的tmp目錄。
  2. 的Hadoop名稱節點-format
  3. start-dfs.sh或start-all.sh
  4. JPS