1

我从http://www.cloudera.com/content/cloudera-content/cloudera-docs/DemoVMs/Cloudera-QuickStart-VM/cloudera_quickstart_vm.html下载的 Cloudera QuickStart VM 出现错误。

我正在尝试 Tom White 的Hadoop: The Definitive Guide book中的一个玩具示例map_temp.pig,它“按年查找最高温度”。

我创建了一个名为的文件temps.txt,每行包含(年份、温度、质量)条目:

1950 0 1

1950 22 1

1950 -11 1

1949 111 1

使用书中的示例代码,我在 Grunt 终端中输入了以下 Pig 代码:

records = LOAD '/home/cloudera/Desktop/temps.txt'

  AS (year:chararray, temperature:int, quality:int);

DUMP records;

输入后DUMP records;,我收到错误:

2014-05-22 11:33:34,286 [main] 错误 org.apache.pig.tools.grunt.Grunt - 错误 1066:无法打开别名记录的迭代器。后端错误:org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException: 带有 id 'application_1400775973236_0006' 的应用程序在 RM 中不存在。

…</p>

日志文件中的详细信息:/home/cloudera/Desktop/pig_1400782722689.log

我试图通过谷歌搜索找出导致错误的原因:https://www.google.com/search?q=%22application+with+id%22+%22doesn%27t+exist+in+RM%22.

那里的结果没有帮助。例如,http://docs.aws.amazon.com/ElasticMapReduce/latest/DeveloperGuide/emr-troubleshoot-error-vpc.html提到了这个错误并说“要解决这个问题,您必须配置一个包含 DHCP 的 VPC选项集,其参数设置为以下值..."

亚马逊建议的修复似乎不是问题,因为我没有使用 AWS。

编辑:

我认为 HDFS 文件路径是正确的。

[cloudera@localhost Desktop]$ ls
Eclipse.desktop  gnome-terminal.desktop  max_temp.pig  temps.txt
[cloudera@localhost Desktop]$ pwd
/home/cloudera/Desktop
4

2 回答 2

2

在您的错误之前还有另一个例外:

org.apache.pig.backend.executionengine.ExecException: ERROR 2118: Input path does not exist: hdfs://localhost.localdomain:8020/home/cloudera/Desktop/temps.txt
    at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigInputFormat.getSplits(PigInputFormat.java:288)

您的文件在 HDFS 中吗?你检查过文件路径吗?

于 2014-05-23T10:10:54.083 回答
1

我能够通过pig -x local启动 Grunt 解释器来解决这个问题,而不仅仅是pig.

我应该使用本地模式,因为我无法访问 Hadoop 集群。

这给了我错误:

2014-05-22 11:33:34,286 [main] 错误 org.apache.pig.tools.grunt.Grunt - 错误 1066:无法打开别名记录的迭代器。后端错误:org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException: 带有 id 'application_1400775973236_0006' 的应用程序在 RM 中不存在。

2014-05-22 11:33:28,799 [JobControl] WARN org.apache.hadoop.security.UserGroupInformation - PriviledgedActionException as:cloudera(auth:SIMPLE) 原因:org.apache.pig.backend.executionengine.ExecException:错误 2118:输入路径不存在:hdfs://localhost.localdomain:8020/home/cloudera/Desktop/temps.txt

来自http://pig.apache.org/docs/r0.9.1/start.html

Pig 有两种执行模式或执行类型:

本地模式- 要在本地模式下运行 Pig,您需要访问单台机器;所有文件都使用本地主机和文件系统安装和运行。使用 -x 标志(pig -x local)指定本地模式。

Mapreduce 模式- 要在 mapreduce 模式下运行 Pig,您需要访问 Hadoop 集群和 HDFS 安装。Mapreduce 模式是默认模式;您可以但不需要使用 -x 标志(pig OR pig -x mapreduce)指定它。

您可以使用“pig”命令(bin/pig Perl 脚本)或“java”命令(java -cp pig.jar ...)在任一模式下运行 Pig。

运行 Tom White 的Hadoop: The Definitive Guide book中的玩具示例:

-- max_temp.pig: Finds the maximum temperature by year
records = LOAD 'temps.txt' AS (year:chararray, temperature:int, quality:int);
filtered_records = FILTER records BY temperature != 9999 AND
  (quality == 0 OR quality == 1 OR quality == 4 OR quality == 5 OR quality == 9);
grouped_records = GROUP filtered_records BY year;
max_temp = FOREACH grouped_records GENERATE group,
  MAX(filtered_records.temperature);
DUMP max_temp;

针对以下数据集temps.txt(请记住,Pig 的默认输入是制表符分隔的文件):

1950   0      1
1950   22     1
1950   -11    1
1949   111    1

给出了这个:

grunt> [cloudera@localhost 桌面]$ pig -x local -f max_temp.pig 2>log

(1949,111)

(1950,22)

于 2014-05-23T18:11:31.847 回答