MapReduce运行异常:Unknown protocol to name node: org.apache.hadoop.mapred.JobSubmissionProtocol
描述:job 配置错误
异常:
14/03/26 22:23:27 ERROR security.UserGroupInformation: PriviledgedActionException as:allen
cause:org.apache.hadoop.ipc.RemoteException: java.io.IOException: Unknown protocol to name node: org.apache.hadoop.mapred.JobSubmissionProtocol
at org.apache.hadoop.hdfs.server.namenode.NameNode.getProtocolVersion(NameNode.java:149)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:563)
at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1388)
at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1384)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:396)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1121)
at org.apache.hadoop.ipc.Server$Handler.run(Server.java:1382)
Exception in thread "main" org.apache.hadoop.ipc.RemoteException: java.io.IOException: Unknown protocol to name node: org.apache.hadoop.mapred.JobSubmissionProtocol
at org.apache.hadoop.hdfs.server.namenode.NameNode.getProtocolVersion(NameNode.java:149)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:563)
at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1388)
at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1384)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:396)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1121)
at org.apache.hadoop.ipc.Server$Handler.run(Server.java:1382)
解决办法:
conf.set("mapred.job.tracker", "ip:端口");
端口和地址在:mapred-site.xml中
<property>
<name>mapred.job.tracker</name>
<value>ip:端口</value>
</property>
如果还无法解决:
注释掉conf.set("mapred.job.tracker", "ip:端口");
然后配置输入输出目录时,配上hdfs的路径
String[] ioArgs = new String[] { "hdfs://ip:端口/mr/sort/sort_in", "hdfs://ip:端口/mr/sort/sort_out" };