问题
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
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?
Please guide.
回答1:
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
来源:https://stackoverflow.com/questions/24619306/trouble-running-pig-in-both-local-or-mapreduce-mode