用mapreduce 处理气象数据集
编写程序求每日最高最低气温,区间最高最低气温
气象数据集下载地址为:ftp://ftp.ncdc.noaa.gov/pub/data/noaa
mkdir qx
cd qx
wget -D --accept-regex=REGEX -p data -r -c ftp://ftp.ncdc.noaa.gov/pub/data/noaa/2018/5*
按学号后三位下载不同年份月份的数据(例如201506110136号同学,就下载2013年以6开头的数据,看具体数据情况稍有变通)
解压数据集,并保存在文本文件中
zcat /ftp.ncdc.noaa.gov/pub/data/noaa/2018/5*.gz >qxdata.txt
对气象数据格式进行解析编写map函数,reduce函数
touch mapper.py
touch reducer.py
将其权限作出相应修改
chmod a+x /home/hadoop/qx/mapper.py
chmod a+x /home/hadoop/qx/reducer.py
本机上测试运行代码
备注:只有一个成功,另一个出错
放到HDFS上运行
将之前爬取的文本文件上传到hdfs上
用Hadoop Streaming命令提交任务查看运行结果