在hadoop和pig安装过程中,经常会出现hadoop和pig版本不兼容的问题,下面基于Hadoop2.3.0和pig0.12.0在安装过程中版本不兼容导致的问题进行说明。 在Hadoop2.3.0和pig0.12.0安装完后,运行过程中,hadoop和pig grunt均运行正常但是dump数据报下面的错误: ERROR 1066: Unable to open iterator for alias actor org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1066: Unable to open iterator for alias actor at org.apache.pig.PigServer.openIterator(PigServer.java:880) at org.apache.pig.tools.grunt.GruntParser.processDump(GruntParser.java:774) at org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:372) at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:198) at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:173) at org.apache.pig.tools.grunt.Grunt.run(Grunt.java:69) at org.apache.pig.Main.run(Main.java:541) at org.apache.pig.Main.main(Main.java:156) 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) at org.apache.hadoop.util.RunJar.main(RunJar.java:212) Caused by: java.io.IOException: Job terminated with anomalous status FAILED at org.apache.pig.PigServer.openIterator(PigServer.java:872) ... 12 more 导致问题出现的原因是pig已经编译的jar文件和hadoop的版本不兼容导致的,可以采用重新编译的方法解决问题,如下所示: (1) cd ${PIG_HOME} (2) mv pig-0.12.0-withouthadoop.jar pig-0.12.0-withouthadoop.jar.bak (3) mv pig-0.12.0.jar pig-0.12.0.jar.bak (4) ant clean jar-withouthadoop -Dhadoopversion=23 编译完成后将在${PIG_HOME}/build目錄下生成: pig-0.12.0-SNAPSHOT.jar, pig-0.12.0-SNAPSHOT-withouthadoop.jar (5) 将上一步生成的两个文件Copy至${PIG_HOME}下,并进行改名: pig-0.12.0-SNAPSHOT.jar --> pig-0.12.0.jar pig-0.12.0-SNAPSHOT-withouthadoop.jar --> pig-0.12.0-withouthadoop.jar (责任编辑:IT) |