Pig 没有 运行 的 mapreduce 心情(hadoop 3.1.1 + pig 0.17.0)

Pig is not running in mapreduce mood (hadoop 3.1.1 + pig 0.17.0)

我是 Hadoop 的新手。我的hadoop版本是3.1.1,pig版本是0.17.0.

在本地模式下运行这个脚本一切正常

pig -x local

grunt> student = LOAD '/home/ubuntu/sharif_data/student.txt' USING PigStorage(',') as ( id:int, firstname:chararray, lastname:chararray, phone:chararray, city:chararray );
grunt> DUMP student;

本地模式的结果

但对于相同的输入文件和 pig 脚本,mapreduce 模式无法成功运行。

pig -x mapreduce

grunt> student = LOAD '/pig_data/student.txt' USING PigStorage(',') AS ( id:int, firstname:chararray, lastname:chararray, phone:chararray, city:chararray );
grunt> STORE student INTO '/pig_data/student_out' USING PigStorage (',');

grunt> student = LOAD 'hdfs://NND1:9000/pig_data/student.txt' USING PigStorage(',') AS ( id:int, firstname:chararray, lastname:chararray, phone:chararray, city:chararray );
grunt> STORE student INTO 'hdfs://NND1:9000/pig_data/student_out' USING PigStorage (',');

mapreduce 模式的结果 要么 注:student.txt上传到HDFS成功。

hdfs dfs -ls  /pig_data 
Found 2 items
-rw-r--r--   3 ubuntu supergroup     861585 2019-07-12 00:55 /pig_data/en.sahih.txt
-rw-r--r--   3 ubuntu supergroup        234 2019-07-12 12:25 /pig_data/student.txt

即使在 grunt 这个命令下 returns 正确的 HDFS 文件名。

grunt> fs -cat /pig_data/student.txt 

感谢任何帮助。

部分问题是 Pig 0.17 还不支持 Hadoop 3。

0.17 的 Apache Pig Releases 状态:

19 June, 2017: release 0.17.0 available

The highlights of this release is the introduction of Pig on Spark

Note: This release works with Hadoop 2.X (above 2.7.x)

并且 JIRA PIG-5253 - Pig Hadoop 3 support 仍在进行中。