【问题标题】:Pig is not running in mapreduce mood (hadoop 3.1.1 + pig 0.17.0)Pig 没有以 mapreduce 心情运行(hadoop 3.1.1 + pig 0.17.0)
【发布时间】:2019-11-21 22:42:18
【问题描述】:

我对 Hadoop 非常陌生。我的hadoop版本是3.1.1,pig版本是0.17.0

通过在本地模式下运行此脚本,一切都按预期工作

猪 -x 本地

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 下,此命令也会返回正确的 HDFS 文件名。

grunt> fs -cat /pig_data/student.txt 
  • 为什么当文件存在于 小路?
  • 我失踪的可能原因是什么?

感谢任何帮助。

【问题讨论】:

  • 你确定不是在本地检查吗?您尚未在 URL 中指定 HDFS。注意这里如何使用完整的 HDFS URL tutorialspoint.com/apache_pig/apache_pig_grunt_shell
  • 为什么我需要 hdfs 路径,因为 pig 可以使用 fs 识别它?仅供参考,我也尝试过使用 hdfs 路径:(
  • 如果指向本地存储的同一个文件,作业是否运行?
  • 是的。在本地模式下,我的本地文件运行成功。唯一的问题是它在 mapreduce 模式下失败并出现如下错误:哎呀!有些工作失败了!如果您希望 Pig 在失败时立即停止,请指定 -stop_on_failure。

标签: hadoop bigdata apache-pig hadoop3


【解决方案1】:

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

Apache Pig Releases 状态为 0.17:

2017 年 6 月 19 日:发布 0.17.0 版

此版本的亮点是在 Spark 上引入 Pig

注意: 此版本适用于 Hadoop 2.X(高于 2.7.x)

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

【讨论】:

  • 感谢您的参考 :) 。我很困惑,因为它在本地模式下工作。
  • 是的,本地模式只使用底层操作系统的文件系统。
  • hive 3.1.1 也一样,它也支持 hadoop 3.1.1。 . issues.apache.org/jira/browse/HIVE-20022(如果有人受益,请在此处粘贴链接作为参考)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-11-15
  • 1970-01-01
  • 2021-12-14
  • 1970-01-01
相关资源
最近更新 更多