运行hadoop wordcount程序

时间:2013-11-10 14:31:06

标签: hadoop word-count

我正在通过michael-noll教程学习hadoop。当我尝试通过运行hadoop jar hadoop-examples-1.2.1.jar wordcount tmp/Files tmp/Output运行wordcount示例时,我收到以下错误:

  

13/11/10 18:09:42 INFO ipc.Client:重试连接到服务器:localhost / 127.0.0.1:54311。已经尝试了0次;重试策略是RetryUpToMaximumCountWithFixedSleep(maxRetries = 10,sleepTime = 1 SECONDS)

     

。   

     

13/11/10 18:09:51错误security.UserGroupInformation:PriviledgedActionException as:hduser cause:java.net.ConnectException:在连接异常时调用localhost / 127.0.0.1:54311失败:java.net.ConnectException:拒绝连接   java.net.ConnectException:在连接异常时调用localhost / 127.0.0.1:54311失败:java.net.ConnectException:拒绝连接

     

org.apache.hadoop.ipc.Client.wrapException(Client.java:1142)   在org.apache.hadoop.ipc.Client.call(Client.java:1118)   在org.apache.hadoop.ipc.RPC $ Invoker.invoke(RPC.java:229)   在org.apache.hadoop.mapred。$ Proxy2.getProtocolVersion(未知来源)   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:606)   在org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:85)   在org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:62)   在org.apache.hadoop.mapred。$ Proxy2.getProtocolVersion(未知来源)   在org.apache.hadoop.ipc.RPC.checkVersion(RPC.java:422)   在org.apache.hadoop.mapred.JobClient.createProxy(JobClient.java:559)   在org.apache.hadoop.mapred.JobClient.init(JobClient.java:498)   在org.apache.hadoop.mapred.JobClient。(JobClient.java:479)   在org.apache.hadoop.mapreduce.Job $ 1.run(Job.java:563)   at java.security.AccessController.doPrivileged(Native Method)   在javax.security.auth.Subject.doAs(Subject.java:415)   在org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1190)   在org.apache.hadoop.mapreduce.Job.connect(Job.java:561)   在org.apache.hadoop.mapreduce.Job.submit(Job.java:549)   在org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:580)   在org.apache.hadoop.examples.WordCount.main(WordCount.java:82)   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:606)   在org.apache.hadoop.util.ProgramDriver $ ProgramDescription.invoke(ProgramDriver.java:68)   在org.apache.hadoop.util.ProgramDriver.driver(ProgramDriver.java:139)   在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:606)   在org.apache.hadoop.util.RunJar.main(RunJar.java:160)   由以下原因引起:java.net.ConnectException:连接被拒绝   at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)   at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:708)   在org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:206)   在org.apache.hadoop.net.NetUtils.connect(NetUtils.java:511)   在org.apache.hadoop.net.NetUtils.connect(NetUtils.java:481)   在org.apache.hadoop.ipc.Client $ Connection.setupConnection(Client.java:457)   在org.apache.hadoop.ipc.Client $ Connection.setupIOstreams(Client.java:583)   在org.apache.hadoop.ipc.Client $ Connection.access $ 2200(Client.java:205)   在org.apache.hadoop.ipc.Client.getConnection(Client.java:1249)   在org.apache.hadoop.ipc.Client.call(Client.java:1093)   ......还有33个

附录

我刚刚重新运行了bin/stop-all.shbin/start-all.shhadoop jar hadoop-examples-1.2.1.jar wordcount tmp/Files tmp/Output这样的命令。但现在我遇到了以下错误:

  

13/11/10 20:52:12错误security.UserGroupInformation:PriviledgedActionException as:hduser cause:org.apache.hadoop.ipc.RemoteException:org.apache.hadoop.mapred.SafeModeException:JobTracker处于安全模式       在org.apache.hadoop.mapred.JobTracker.checkSafeMode(JobTracker.java:5188)       在org.apache.hadoop.mapred.JobTracker.getStagingAreaDir(JobTracker.java:3677)       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:606)       在org.apache.hadoop.ipc.RPC $ Server.call(RPC.java:587)       在org.apache.hadoop.ipc.Server $ Handler $ 1.run(Server.java:1432)       在org.apache.hadoop.ipc.Server $ Handler $ 1.run(Server.java:1428)       at java.security.AccessController.doPrivileged(Native Method)       在javax.security.auth.Subject.doAs(Subject.java:415)       在org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1190)       在org.apache.hadoop.ipc.Server $ Handler.run(Server.java:1426)

org.apache.hadoop.ipc.RemoteException:org.apache.hadoop.mapred.SafeModeException:JobTracker处于安全模式     在org.apache.hadoop.mapred.JobTracker.checkSafeMode(JobTracker.java:5188)     在org.apache.hadoop.mapred.JobTracker.getStagingAreaDir(JobTracker.java:3677)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

Plz帮助

2 个答案:

答案 0 :(得分:1)

尝试手动关闭安全模式:

hadoop dfsadmin -safemode off

hadoop dfsadmin -safemode leave

然后重新运行你的工作。

答案 1 :(得分:0)

这是因为您的JobTracker处于安全模式,而不是nameNode。使用以下命令确保JT不在安全模式中:

bin/hadoop mradmin -safemode leave

您可以随时使用以下显示的命令检查您的NN和JT是否超出安全模式;

bin/hadoop mradmin -safemode get

bin/hadoop dfsadmin -safemode get

另外,请确保您使用正确的用户启动守护进程。

enter image description here

@Praveen Sripati:请看第二个选项。