我正在本地桌面上试用 apache pig。
我希望 apache 页面上的教程是准确的或调用步骤。我安装了 pig 并试图粘贴示例代码:从这里http://pig.apache.org/docs/r0.7.0/setup.html#Sample+Code
Local Mode
$ pig -x local
Mapreduce Mode
$ pig
or
$ pig -x mapreduce
For either mode, the Grunt shell is invoked and you can enter commands at the prompt. The results are displayed to your terminal screen (if DUMP is used) or to a file (if STORE is used).
grunt> A = load 'passwd' using PigStorage(':');
grunt> B = foreach A generate $0 as id;
grunt> dump B;
grunt> store B;
不清楚我是否必须输入 pig -x local 来尝试 grunt 命令 [可能是 pig 必须以两种模式之一运行,但不明显开箱即用的操作]
我输入后
pig -x local
我得到 grunt 提示,但命令失败说:
Message: org.apache.pig.backend.executionengine.ExecException: ERROR 2118: Input path does not exist: file:/home/<usr>/passwd
在搜索谷歌时,我被路由到这样的邮件档案:http://mail-archives.apache.org/mod_mbox/pig-user/201109.mbox/%3C4E73658D.3000705@figarocms.fr%3E 这些很难阅读并关注对话。
这是我正在寻找的两件事:1]在您开始使用有线之前,是否有更好的指南来编写猪脚本和UDF,可以让您掌握一段时间[至少让您通过编写1-2个UDF来分析示例日志]错误。任何博客文章等如果说我有 4 个小时来编写几个简单的猪脚本,那么一个好的起点是什么 2] 对于我得到的错误,我可能需要将 passwd 文件添加到 HDFS 吗?不幸的是,“hadoop fs -mkdir -p /home/”表示该目录存在。那么我现在如何将文件放在那里。由于我在本地模式下运行它,有没有办法让 HDFS 在我在 FS 上提到的路径上查找文件,而不是每次都将文件放到 HDFS 上?
谢谢!