本篇 linux安装hadoop集群(3)-运行Java程序
1 准备文件
[root@hpmaster chy]# pwd
/usr/chy
[root@hpmaster chy]# ls
temperature-01
2 文件内容
[root@hpmaster chy]# cat /usr/chy/temperature-01
1985 07 31 02 200
1985 07 31 03 172
1985 07 31 04 156
1985 07 31 05 133
1985 07 31 06 122
1985 07 31 07 117
1985 07 31 08 111
1985 07 31 09 111
1985 07 31 10 106
1985 07 31 11 100
3 上传hdfs
[root@hpmaster sbin]# hdfs dfs -mkdir /chy-data/input
[root@hpmaster sbin]# hdfs dfs -put /usr/chy/temperature-01 /chy-data/input/temperature-014
5 浏览文件
http://hpmaster:50070/explorer.html

6 编写java程序
public class Temperature extends Configured implements Tool {
public static class TemperatureMapper extends Mapper< LongWritable, Text, Text, IntWritable> {
@Override
public void map(LongWritable key, Text va

本文档详细介绍了如何在Linux系统中安装并配置Hadoop集群,然后逐步指导如何上传本地数据到HDFS,编写并执行Java MapReduce程序处理数据,最后展示如何查看执行结果。通过实例展示了在Hadoop上执行Java应用程序的过程。
最低0.47元/天 解锁文章
678

被折叠的 条评论
为什么被折叠?



