Pig安装
环境:
hadoop-2.4.1、jdk1.6.0_45、pig-0.12.1
1、下载pig并解压
tar -xzvf pig-0.12.1.tar.gz
2、设置环境变量
export PIG_HOME=~/pig-0.12.1 export PATH=$PATH:$PIG_HOME/bin
3、测试
pig -help
4、说明
1)同一个pig支持多个hadoop版本
2)pig默认通过HADOOP_HOME确定hadoop的版本及安装位置,如果没有HADOOP_HOME环境变量,则pig使用其内置的hadoop版本
3)/bin/pig,可以在这里配置环境变量,比如覆盖全局的HADOOP_HOME
The Pig command script # # Environment Variables # # JAVA_HOME The java implementation to use. Overrides JAVA_HOME. # # PIG_CLASSPATH Extra Java CLASSPATH entries. # # PIG_USER_CLASSPATH_FIRST If set, add user provided classpath entries to # the top of classpath instead of appending them. # Default is unset, i.e. the classpath entries are # placed normally at the end of a pre-defined classpath. # # HADOOP_HOME/HADOOP_PREFIX Environment HADOOP_HOME/HADOOP_PREFIX(0.20.205) # # HADOOP_CONF_DIR Hadoop conf dir # # PIG_HEAPSIZE The maximum amount of heap to use, in MB. # Default is 1000. # # PIG_OPTS Extra Java runtime options. # # PIG_CONF_DIR Alternate conf dir. Default is ${PIG_HOME}/conf. # # HBASE_HOME Optionally, the HBase installation directory. # Defaults to ${PIG_HOME}/share/hbase # # HBASE_CONF_DIR - Optionally, the HBase configuration to run against # when using HBaseStorage. Defaults to ${HBASE_HOME}/conf
4)/conf/pig.properties
这里存放一些属性值,在执行pig脚本的时候默认加载。
注意:如果执行pig客户端的用户跟hadoop集群的用户不是一个用户,需要将hdfs上的/tmp目录设置成777权限
hdfs dfs -chmod -R 777 /tmp