MapReduce

mapreduce分布式运算框架详解 (MAPREDUCE详解) MapReduce快速入门 如何理解map、reduce计算模型 Mapreudce程序运行演示 Mapreduce编程规范及示例编写 Mapreduce程序运行模式及debug方法 MapReduce高级特性 Mapreduce程序的核心机制 MapReduce的序列化框架 MapReduce的排序实现 MapReduce的分区机制及自定义 Mapreduce的数据压... 阅读详情

http://weblogs.java.net/blog/tomwhite/archive/2005/09/mapreduce.html

Doug Cutting has done it again. The creator of Lucene and Nutch has implemented (with Mike Cafarella and others) a distributed platform for high volume data processing called MapReduce.

MapReduce is the brainchild of Google and is very well documented by Jeffrey Dean and Sanjay Ghemawat in their paper MapReduce: Simplified Data Processing on Large Clusters. In essence, it allows massive data sets to be processed in a distributed fashion by breaking the processing into many small computations of two types: a map operation that transforms the input into an intermediate representation, and a reduce function that recombines the intermediate representation into the final output. This processing model is ideal for the operations a search engine indexer like Nutch or Google needs to perform - like computing inlinks for URLs, or building inverted indexes - and it will transform Nutch into a scalable, distributed search engine.

Nutch MapReduce takes advantage of the Nutch Distributed File System (NDFS) - itself inspired by another Google Labs project, the Google File System. NDFS provides a fault-tolerant environment for working with very large files using cheap commodity hardware.

Currently MapReduce is a part of Nutch, but it has been proposed that it and NDFS be moved into a separate project. However, it is perfectly possible to use the MapReduce functionality in Nutch for your own data processing. In this blog, I'll briefly describe how to get started.

Building MapReduce in Nutch

The MapReduce implementation in Nutch is still in active development, so it is best to get the latest sources from subversion and build them yourself. It's very easy. At the moment the latest MapReduce work isn't in trunk (though it may be soon). I checked out the mapred branch from subversion (the URL is http://svn.apache.org/repos/asf/lucene/nutch/). Then I typed

ant tar

in the base directory, and a few minutes later out popped nutch-0.8-dev.tar.gz, which I unpacked on my system.

A MapReduce example

The demo program that comes with Nutch MapReduce is a distributed grep. Actually, it's a bit more than grep, it behaves more like the following UNIX command line,

    grep -Eh <regex> <inDir>/* | sort | uniq -c | sort -nr
    

which counts the number of lines in all files in <inDir> that match <regex> and displays the counts in descending order.

An example of where this kind of query might be useful is analysing web server access logs to find the top requested pages that match a given pattern. But imagine trying to grep gigabytes of data - the standard UNIX tools don't scale, so a way of breaking the work into pieces and parallelizing it across a number of machines is the only way to get an answer in a reasonable time.

Let's look at a trivial example to understand MapReduce and the grep demo. There are two files in a directory called in, called a and b, with the following contents:

    C
    B
    B
    C
    

and

    C
    A
    

respectively.

Running the UNIX command line

    grep -Eh 'A|C' in/* | sort | uniq -c | sort -nr
    

gives

      3 C
      1 A
    

Similarly, the MapReduce version

    bin/nutch org.apache.nutch.mapred.demo.Grep in out 'A|C'
    

creates a file called part-00000 in the output directory out containing the same result:

    3 C
    1 A
    

The MapReduce algorithm breaks the operation into a user-defined map operation and a user-defined reduce operation. The map operation takes as input a key-value pair and outputs a list of intermediate key-value pairs. For grep the input is (file offset, line) (although we don't use the file offset), and the output is either an empty list [] if the line does not match the regex, or a single-element list of a key-value pair [(line, 1)] if it matches:

    (0, C) -> [(C, 1)]
    (2, B) -> []
    (4, B) -> []
    (6, C) -> [(C, 1)]
    (0, C) -> [(C, 1)]
    (2, A) -> [(A, 1)]
    

The MapReduce implementation then gathers up all the intermediate key-value pairs with the same key for the reduce operation to turn into a list of values. For grep the input is (line, [1, 1, ...]) and the output is (line, n) where n is the number of 1s in the list.

    (A, [1])       -> (A, 1)
    (C, [1, 1, 1]) -> (C, 3)
    

The sorting part of the program is actually implemented as another MapReduce job, using the output of the first as input. Details are in the source code, and also in sections 4.1 and 4.2 of the Google paper.

Distributed Nutch MapReduce

So far Nutch MapReduce has been running in its default, single JVM mode. To scale up to do serious data processing, MapReduce needs to be run on multiple nodes. In a nutshell, a single JobTracker runs on a master node and hands out map tasks and reduce tasks to TaskTrackers running on slave nodes. These processes are launched by running a script on the master node that starts the JobTracker, then starts the TaskTracker slave processes over SSH. Note that dynamic classloading (using RMI, or Jini's JERI, for example) is not used to distribute the job's map and reduce classes to each slave - they must be installed beforehand on each slave node. (This is not a big deal for the grep example - or indeed the MapReduce infrastructure for Nutch in general - since the classes are a part of the Nutch MapReduce package.)

It is still early days for Nutch MapReduce, and there is very little documentation yet. However, using a combination of Doug Cutting's OSCON 2005 presentation, his cheat sheet (found on the excellent Nutch mailing lists), and digging around in the source code, I managed to get MapReduce running in a distributed set up. One neat feature is the way you can track a job's progress by connecting to the embedded HTTP server that JobTracker runs.

Nutch MapReduce may not be finished, but most of the major pieces seem to be in place, so it is only a matter of time before this exciting and powerful tool sees wider adoption.

MapReduce总结 MapReduce是一种可用于数据处理的编程模型。MapReduce程序本质上是并行运行的,优势在于处理大规模数据集。本文介绍了Hadoop MapReduce的架构,并结合具体例子介绍MapReduce的工作过程,以更深入的了解MapReduce。 阅读详情

相关推荐

从MapReduce到Hive

1.计算框架 Hadoop 是一个计算框架,目前大型数据计算框架常用的大致有五种: 仅批处理框架:Apache hadoop. 仅流处理框架:Apache Storm、Apache Samza. 混合框架:Apache Spark、Apache Flink. 这其中名气最大、使用最广的当属 Hadoop 和 Spark。 虽然两者都被称为大数据框架,但实际层级不同。Hadoop 是一个分布式数...

liyifan687的博客 1617

MapReduce 中的文件名通配与过滤

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_33762130的博客 325

与rkipc通信

函数名称功能系统模块初始化系统模块反初始化重启恢复出厂设置导出日志导出配置文件导入配置文件系统升级获取用户数设置用户数获取用户权限设置用户权限获取用户名设置用户名获取密码(已加密)设置密码(已加密)新增用户删除用户。

qq_44643189的博客 1617

hadoop学习笔记之grep

import java.util.Random; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.ap

云守护的专栏 2857

手把手教你用芯驰X9HP驱动MAX96755/MAX96752点亮智能座舱仪表屏(附完整寄存器配置表)

本文详细介绍了如何使用芯驰X9HP驱动MAX96755/MAX96752实现智能座舱仪表屏的完整开发流程,包括硬件架构解析、关键寄存器配置、Linux BSP集成及调试技巧。通过实战指南和完整寄存器配置表,帮助开发者快速掌握驱动开发核心技术,提升智能座舱系统的显示性能与稳定性。

weixin_30879169的博客 537

攻防世界:Crypto习题之easy_RSA

在非对称加密算法中,单向函数被广泛应用,用于确保从公钥加密后的密文无法轻易推导出私钥,从而保证数据的安全性。而其中最著名的算法便是 RSA 加密算法。首先设φm:=∣1≤k≤mgcdkm1∣为欧拉函数(Euler’sche Phi-function)。pqn:=pqpqφnnpqpqφnp−1q−1e∈12...φn−1gcdφne1ended≡1φn假设我们现在有明文x以及公钥en。

qq_52789488的博客 1579

MAPREDUCE详解

1. MAPREDUCE原理篇(1) Mapreduce是一个分布式运算程序的编程框架,是用户开发“基于hadoop的数据分析应用”的核心框架; Mapreduce核心功能是将用户编写的业务逻辑代码和自带默认组件整合成一个完整的分布式运算程序,并发运行在一个hadoop集群上; 1.1 为什么要MAPREDUCE (1)海量数据在单机上处理因为硬件资源限制,无法胜任 (2)而一旦将单机版程序扩展到集群来分布式运行,将极大增加程序的复杂度和开发难度 (3)引入mapreduce框架后,开发人员

woaini886353的博客 2万+

AD936x Evaluation Software 实战配置指南:从寄存器设置到滤波器优化

本文提供AD936x Evaluation Software的实战配置指南,详细解析从工程创建、RF向导与时钟模块配置,到数字滤波器优化、数字接口设置及增益控制的完整流程。重点分享寄存器设置、滤波器系数权衡及PLL稳定技巧等核心要点,帮助开发者高效配置AD9361/AD9363射频芯片,快速应用于SDR、基站等场景。

perl8的博客 710

mapreduce的工作原理

虽然新框架(如 Spark)在性能上更优,但 MapReduce 仍是 Hadoop 生态的核心组件,理解其原理对学习大数据技术至关重要。的思想,将大数据任务分解为多个小任务,并行处理后再合并结果。如果某个 Task 执行过慢,集群会启动相同任务的备份,取最先完成的结果。:在 Reduce 阶段前,数据按键排序,便于归约处理。在 Map 阶段后,先对本地数据进行聚合,减少网络传输。:处理输入数据,生成键值对(Key-Value)。:合并 Map 阶段的输出,生成最终结果。读取输入分片,逐行处理数据,生成。

2301_81748087的博客 1811

绕过App某加密企业版加固Frida检测

可以发现dlsym函数加载了两次pthread_create,可以认为这两个进程(或某一个进程)是和Frida的检测有关的,于是为了绕过检测,我们可以让它加载一个虚假的pthread_create函数,得到一个空结果绕过检测。成功绕过了libnllvm1717052779924.so的检测,又到了libface_nllvm.so的检测,使用同样的方法去绕过libface_nllvm.so的检测,代码我这里就不上了,大家可以自己修改以下。dlsym()函数的作用是在已经加载的动态链接库中查找指定符号的地址。

墨痕诉清风的博客 1641

C++程序发生内存越界,一定会导致程序崩溃吗?详解内存越界

内存越界是否一定会导致程序崩溃吗?详解内存越界

dvlinker的技术专栏 1万+

MapReduce算法步骤

计算步骤 : 第1步:InputFormat InputFormat到 hdfs 上 读取数据将 数据 传给Split 第2步:Split Split 将数据 进行 逻辑切分, 将数据 传给RR 第3步:RR RR: 将传入的 数据 转换成 一行一行 的数据,输出行首字母偏移量和 偏移量对应的数据 将数据 传给MAP (偏移量:每个字符移动到当前文档的...

最慢的步伐不是跬步,而是徘徊;最快的脚步不是冲刺,而是坚持 8625

使用node-red网关读取modbus设备点表,并上传到市政低碳平台来统计数据

最近做了一个物联网项目,具体是这样的,利用node-red网关盒子,来采集Modbus设备的点表,然后将数据转换,封装,最终上传到市政的低碳平台。上一步封装了点表的数据,调用低碳平台还需要账号密码,建筑id,这些都是固定信息,所以我们单独提出来。上一步获取到了原始的点表数据,下一步就是将这些点表数据与在低碳平台创建的采集的对应起来,并且设置好分类。读取modbus的节点,会有两个输出,我是使用的第一个输出。msg.meters 是一个数组,里面的每一个元素都是一个点表,比如厨房用水,园区照明,

知无涯 956

【Hadoop】MapReduce详解

MapReduce详解MapReduce介绍MapReduce的基本编程模型MapReduce的计算过程1. Map阶段可以概括为5个步骤:2. Reduce节点也可以分为5个步骤:设置ReduceTask并行度(个数)关于分片(Split)关于ShuffleMap端的shuffleReduce端的ShuffleShuffle流程详解补充问题:MapReduce分区相关问题理解1.Partition的原理和作用2.Partition的使用3.分组的概念和使用分组排序的步骤4.Combiner的使用概念实现步

小哲的博客 9505

手把手教您国内安装 Claude Code 并配置自定义大模型(包含New-API中转和可视化管理工具的使用)

国内免魔法畅用 Claude Code!手把手教你 Windows 安装、配置文件写法、对接阿里百炼 / DeepSeek / 智谱✨,附完整参数、正确命令、三方工具管理方案,新手一次成功!✅

XiaoqiangClub的博客 3804

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

MapReduce中加强内容

课程大纲(MAPREDUCE详解) MapReduce快速入门 如何理解map、reduce计算模型 Mapreudce程序运行演示 Mapreduce编程规范及示例编写 Mapreduce程序运行模式及debug方法 MapReduce高级特性 Mapreduce程序的核心机制

qq_35866738的博客 1775

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

HADOOP-MapReduce简介

MapReduce是什么?MapReduce是一种编程模型,用于大规模数据集(大于1TB)的并行运算。它极大的方便编程人员在不会分布式并行编程的情况下,将自己的程序运行在分布式系统上。它的实现是map函数和Reduce函数组成。这种编程模型在很长时间以前就出现了,但在以前这个编程模型不是非常火热。当GOOGLE将几篇关于MapReduce的文章发布出来之后,这个编程模型变得异常火爆,Hadoop的

Q 9956

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

Hadoop之MapReduce总结

第1章 MapReduce概述 1.1 MapReduce定义 1.2 MapReduce优缺点 1.2.1 优点 1.2.2 缺点 MapReduce核心思想 MapReduce核心编程思想,如下图 1)分布式的运算程序往往需要分成至少2个阶段。 2)第一个阶段的MapTask并发实例,完全并行运行,互不相干。 3)第二个阶段的ReduceTask并发实例互不相干,但是他们的数据依赖...

Li_Jian_Hui_的博客 7863

MapReduce和yarn的联系

MapReduce和yarn 1.Mapreduce是什么? Mapreduce是一个分布式运算程序的编程框架,是用户开发“基于hadoop的数据分析应用”的核心框架; Mapreduce核心功能是将用户编写的业务逻辑代码和自带默认组件整合成一个完整的分布式运算程序,并发运行在一个hadoop集群上; inputFormat:MapReduce框架使用InputFormat模块做Map前的预处...

Alano1994的博客 3374

mapreduce实践篇

mapreduce实践篇MAPREDUCE实例编写及编码规范编程规范 用户编写的程序分成三个部分:Mapper,Reducer,Driver(提交 运行mr程序的客户端) Mapper的输入数据是KV对的形式(KV类型可以自定义) Mapper的输出数据是KV对的形式(KV的类型可自定义) Mapper中的业务逻辑写在map()方法中 map()方法(maptask进程)对每一个一个简单的Mapre

A__loser的博客 1541

MapReduce编程

一、MapReduce编程规范 MapReduce的开发一共又八个步骤,其中Map阶段分为2个步骤,Shuffle阶段4个步骤,Reduce阶段分为2个步骤。 1.1 步骤流程 Map阶段2个步骤 设置InputFormat类,将数据切分为key-value(k1和v1)对,输入到第二步; 自定义Map逻辑,将第一步的结果转换为另外的Key-Value(k2和v2)对,输出结果。 Shuffle阶段的4个步骤 对输出的Key-Value进行分区; 对不同分区的数据按照相同的Key排序; (可选)对

HeiSeXingYe的博客 3933

MapReduce完整流程

上一篇文章介绍了MapReduce编程模型 这次我们介绍MapReduce完整流程 Map阶段其实主要就是将输入的文件切割成一个个的(K,V)对,主要是******maptask工作机制****** (1)Read阶段:MapTask通过用户编写的RecordReader,从输入InputSplit中解析出一个个key/value。 (2)Map阶段:该节点主要是将解析出的key/value交给用户编写map()函数处理,并产生一系列新的key/value。 (3)Collect收集阶段:在用户编写map

莲芸轩的书房 6565

MapReduce详解

1.MapReduce框架 一个完整的mapreduce程序在分布式运行时有三类实例进程: 1、MRAppMaster:负责整个程序的过程调度及状态协调 2、mapTask:负责map阶段的整个数据处理流程 3、ReduceTask:负责reduce阶段的整个数据处理流程 运行流程: 一个MR程序启动的时候,最先启动的是MRAppMaster,MRAppMaster启动后根据本次job的描述信...

Mr_Lon的博客 1249

MapReduce的shuffle机制

MapReduce原理篇 1.1 MapReduce的shuffle机制 1.1.1 概述:  mapreduce中,map阶段处理的数据如何传递给reduce阶段,是mapreduce框架中最关键的一个流程,这个流程就叫shuffle;  shuffle: 洗牌、发牌——(核心机制:数据分区,排序,缓存);  具体来说:就是将maptask输出的处理结果数据,分发给reducetask,并在分发的过程中,对数据按key进行了分区和排序; 1.1.2 主要流程: Shuffle缓存流程: shu.

eyexin2018的博客 2184

1、MapReduce理论简介

简化并行编程:开发者只需关注 map 和 reduce 两个函数的实现自动容错:框架自动处理节点故障和数据重试负载均衡:自动将任务分配到可用节点可扩展性:可轻松扩展到数千个节点处理 PB 级数据MapReduce 通过将复杂的分布式计算问题抽象为简单的 map 和 reduce 操作,大大降低了大规模数据处理的编程难度,成为大数据处理领域的重要基石。MapReduce处理大数据集的过程。

ywl470812087的博客 11万+
上一篇: Nutch 0.7.2 发布
下一篇: Liferay4.0RC1初印象
lwowen
博客等级 码龄26年 0粉丝 32原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值