在本地或 mapreduce 模式下运行 pig 时遇到问题 [英] Trouble running pig in both local or mapreduce mode
问题描述
我的 Ubuntu VM 上已经运行了 Hadoop 1.2,该 VM 运行在 Windows 7 机器上.我最近在同一个 Ubuntu VM 上安装了 Pig 0.12.0.我已经从 apache 网站下载了 pig-0.12.0.tar.gz.我已经正确设置了所有变量,例如 JAVA_HOME、HADOOP_HOME、PIG_HOME 变量.当我尝试在本地模式下启动 pig 时,我看到的是:
I already have Hadoop 1.2 running on my Ubuntu VM which is running on Windows 7 machine. I recently installed Pig 0.12.0 on my same Ubuntu VM. I have downloaded the pig-0.12.0.tar.gz from the apache website. I have all the variables such as JAVA_HOME, HADOOP_HOME, PIG_HOME variables set correctly. When I try to start pig in local mode this is what I see:
chandeln@ubuntu:~$ pig -x local
pig: invalid option -- 'x'
usage: pig
chandeln@ubuntu:~$ echo $JAVA_HOME
/usr/lib/jvm/java7
chandeln@ubuntu:~$ echo $HADOOP_HOME
/usr/local/hadoop
chandeln@ubuntu:~$ echo $PIG_HOME
/usr/local/pig
chandeln@ubuntu:~$ which pig
/usr/games/pig
chandeln@ubuntu:~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/java7/bin:/usr/local/hadoop/bin:/usr/local/pig/bin
由于我不是 Unix 专家,我不确定这是否是问题所在,但是命令 which pig
实际上返回的是 /usr/games/pig
而不是 /usr/local/pig
.这是问题的根本原因吗?
Since I am not a Unix expert I am not sure if this is the problem but the command which pig
actually returns /usr/games/pig
instead of /usr/local/pig
. Is this the root cause of the problem?
请指导.
推荐答案
我能够通过更改 .bashrc 中的以下几行来解决该问题.这优先于 /usr/local/pig
目录而不是 /usr/games/pig
I was able to fix the problem by changing the following lines in my .bashrc. This gave precedence to the /usr/local/pig
directory instead of /usr/games/pig
BEFORE: export PATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$PIG_HOME/bin
AFTER: export PATH=$JAVA_HOME/bin:$HADOOP_HOME/bin:$PIG_HOME/bin:$PATH
这篇关于在本地或 mapreduce 模式下运行 pig 时遇到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!