大数据之pig安装
1.下载
2. 解压安装
mapreduce模式安装:
1:设置HADOOP_HOME,如果pig所在节点不是集群中的节点,那就需要把集群中使用的hadoop的安装包拷贝过来一份。
export HADOOP_HOME=/usr/local/hadoop-2.6.0
2:创建一个文件夹,cluster-conf,里面保存的是hadoop的配置文件,core-site.xml、hdfs-site.xml、mapred-site.xml、yarn-site.xml,具体配置属性参考提供的配置文件
export PIG_CLASSPATH=../cluster-conf
export HADOOP_CONF_DIR=../cluster-conf
download 4 files about hadoop for pig
注意:如果在执行的过程中报错(右图),则需要在主节点启动job history server(因为pig在hadoop集群上执行任务之后需要解析执行日志才能知道任务是否执行成功。)
sbin/mr-jobhistory-daemon.sh start historyserver
(一定要在resourceManager主节点上运行)
3.检测:
pig
进入:
然后在指定hadoop 上的文件
hello.text
hello you hello me
运行:
A= load ‘hdfs://hadoop11:9000/hello.txt’as (name:chararray,myname:chararray);
dump A;
最后显示统计结果。success